当前位置: 首页>>代码示例>>Python>>正文


Python common.log_debug函数代码示例

本文整理汇总了Python中spacewalk.common.log_debug函数的典型用法代码示例。如果您正苦于以下问题:Python log_debug函数的具体用法?Python log_debug怎么用?Python log_debug使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了log_debug函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: moveChannelDownloads

 def moveChannelDownloads(self, channel_id, old_channel_family_id,
                            new_channel_family_id, username, password):
     log_debug(3)
     self._auth(username, password)
     
     if old_channel_family_id is None or \
            old_channel_family_id == new_channel_family_id:
         # Nothing to be done here, same channel family
         return 0
     log_debug(3, "  Migrating downloads")
     
     try:
         rhnSQL.execute("""
         update rhnDownloads
            set channel_family_id = :new_channel_family_id
          where channel_family_id = :old_channel_family_id
            and id in (
                select downloads_id
                  from rhnChannelDownloads
                 where channel_id = :channel_id)
             """,
             channel_id=channel_id,
             old_channel_family_id=old_channel_family_id,
             new_channel_family_id=new_channel_family_id,
             )
     except rhnSQL.SQLError, e:
         rhnSQL.rollback()
         raise rhnFault(23, str(e.args[1]), explain=0 )
开发者ID:bjmingyang,项目名称:spacewalk,代码行数:28,代码来源:channel.py

示例2: initiate

def initiate(server_id, action_id, dry_run=0):
    log_debug(3)
    h = rhnSQL.prepare(_query_initiate_guest)
    h.execute(action_id=action_id)
    row = h.fetchone_dict()

    if not row:
        raise InvalidAction("Kickstart action without an associated kickstart")
    
    kickstart_host  = row['kickstart_host']
    virt_type       = row['virt_type']
    name            = row['guest_name']
    boot_image      = "spacewalk-koan"
    append_string   = row['append_string']
    vcpus           = row['vcpus']
    disk_gb         = row['disk_gb']
    mem_kb          = row['mem_kb']
    ks_session_id   = row['ks_session_id']
    virt_bridge     = row['virt_bridge']
    disk_path       = row['disk_path']
    cobbler_system_name = row['cobbler_system_name'] 
    
    if not boot_image:
        raise InvalidAction("Boot image missing")

    return (kickstart_host, cobbler_system_name, virt_type, ks_session_id, name,
                mem_kb, vcpus, disk_gb, virt_bridge, disk_path, append_string)
开发者ID:bjmingyang,项目名称:spacewalk,代码行数:27,代码来源:kickstart_guest.py

示例3: _cacheObj

    def _cacheObj(self, fileName, version, dataProducer, params=None):
        """ The real workhorse for all flavors of listall
            It tries to pull data out of a file; if it doesn't work,
            it calls the data producer with the specified params to generate
            the data, which is also cached.

            Returns a string from a cache file or, if the cache file is not
            there, calls dataProducer to generate the object and caches the
            results
        """

        log_debug(4, fileName, version, params)
        fileDir = self._getPkgListDir()
        filePath = "%s/%s-%s" % (fileDir, fileName, version)
        if os.access(filePath, os.R_OK):
            # Slurp the file
            f = open(filePath, "r")
            data = f.read()
            f.close()
            return data

        # The file's not there; query the DB or whatever dataproducer used.
        if not params:
            stringObject = dataProducer()
        else:
            stringObject = apply(dataProducer, params)
        # Cache the thing
        cache(stringObject, fileDir, fileName, version)
        # Return the string
        return stringObject
开发者ID:pombredanne,项目名称:spacewalk-1,代码行数:30,代码来源:rhnRepository.py

示例4: _transformKickstartRequestForBroker

    def _transformKickstartRequestForBroker(self, req):

        # Get the checksum for the requested resource from the satellite.

        (status, checksum) = self._querySatelliteForChecksum(req)
        if status != apache.OK or not checksum:
            return status

        # If we got this far, we have the checksum.  Create a new URI based on
        # the checksum.

        newURI = self._generateCacheableKickstartURI(req.uri, checksum)
        if not newURI:
            # Couldn't create a cacheable URI, log an error and revert to 
            # BZ 158236 behavior.

            log_error('Could not create cacheable ks URI from "%s"' % req.uri)
            return apache.OK

        # Now we must embed the old URI into a header in the original request
        # so that the SSL Redirect has it available if the resource has not 
        # been cached yet.  We will also embed a header that holds the new URI,
        # so that the content handler can use it later.

        log_debug(3, "Generated new kickstart URI: %s" % newURI)
        req.headers_in.add(HEADER_ACTUAL_URI, req.uri)
        req.headers_in.add(HEADER_EFFECTIVE_URI, newURI)

        return apache.OK
开发者ID:pombredanne,项目名称:spacewalk-1,代码行数:29,代码来源:apacheHandler.py

示例5: add_tools_channel

def add_tools_channel(server_id, action_id, dry_run=0):
    log_debug(3)
    if (not dry_run):
        subscribe_to_tools_channel(server_id)
    else:
        log_debug(4, "dry run requested")
    raise ShadowAction("Subscribed guest to tools channel.")
开发者ID:bjmingyang,项目名称:spacewalk,代码行数:7,代码来源:kickstart_guest.py

示例6: upload

def upload(server_id, action_id, dry_run=0):
    log_debug(3)
    h = rhnSQL.prepare(_query_upload_files)
    h.execute(action_id=action_id, server_id=server_id)
    files = map(lambda x: x['path'], h.fetchall_dict() or [])

    return action_id, files
开发者ID:bjmingyang,项目名称:spacewalk,代码行数:7,代码来源:configfiles.py

示例7: initiate

def initiate(server_id, action_id, data={}):
    log_debug(3, action_id)

    action_status = rhnFlags.get('action_status')
    server_kickstart.update_kickstart_session(server_id, action_id,
        action_status, kickstart_state='injected',
        next_action_type='reboot.reboot')
开发者ID:bjmingyang,项目名称:spacewalk,代码行数:7,代码来源:kickstart.py

示例8: handler

    def handler(self):
        """ Main handler for all requests pumped through this server. """

        log_debug(4, 'In redirect handler')
        self._prepHandler()
        #self.__checkLegalRedirect()

        # Rebuild the X-Forwarded-For header so that it reflects the actual
        # path of the request.  We must do this because squid is unable to
        # determine the "real" client, and will make each entry in the chain
        # 127.0.0.1.
        _oto = rhnFlags.get('outputTransportOptions')
        _oto['X-Forwarded-For'] = _oto['X-RHN-IP-Path']

        self.rhnParent = self.rhnParent or '' # paranoid

        log_debug(4, 'Connecting to parent...')
        self._connectToParent()  # part 1

        log_debug(4, 'Initiating communication with server...')
        status = self._serverCommo(self.req.read())       # part 2
        if (status != apache.OK) and (status != apache.HTTP_PARTIAL_CONTENT):
            log_debug(3, "Leaving handler with status code %s" % status)
            return status

        log_debug(4, 'Initiating communication with client...')
        # If we got this far, it has to be a good response
        return self._clientCommo(status)
开发者ID:pombredanne,项目名称:spacewalk-1,代码行数:28,代码来源:rhnRedirect.py

示例9: test_login

 def test_login(self, username, password):
     log_debug(5, username)
     try:
         authobj = auth( username, password )
     except:
         return 0
     return 1
开发者ID:bjmingyang,项目名称:spacewalk,代码行数:7,代码来源:packages.py

示例10: mtime_upload

def mtime_upload(server_id, action_id, data={}):
    # at this point in time, no rhnActionConfigFileName entries exist, because
    # we didn't know them at schedule time...  go ahead and create them now, and then
    # just use the main upload to handle the updating of the state...
    paths = data.get('attempted_paths') or []

    if not paths:
        log_debug(6, "no matched files")
        return

    log_debug(6, 'attempted paths', paths)

    # if there are already rhnActionConfigFileName entries for this sid+aid,
    # it's most likely a rescheduled action, and we'll need to blow away the old
    # entries (they might not be valid any longer)
    h = rhnSQL.prepare(_query_any_action_config_filenames)
    h.execute(server_id=server_id, action_id=action_id)
    already_filenames = h.fetchone_dict() or []

    if already_filenames:
        h = rhnSQL.prepare(_query_clear_action_config_filenames)
        h.execute(server_id=server_id, action_id=action_id)
    
    num_paths = len(paths)
        
    h = rhnSQL.prepare(_query_create_action_config_filename)    
    h.execute_bulk({
        'action_id' : [action_id] * num_paths,
        'server_id' : [server_id] * num_paths,
        'path' : paths,
        })

    upload(server_id, action_id, data)
开发者ID:bjmingyang,项目名称:spacewalk,代码行数:33,代码来源:configfiles.py

示例11: __redirectFailover

    def __redirectFailover(self):
        """ This routine resends the original request back to the satellite/hosted
            system if a redirect to a 3rd party failed.  To prevent redirection loops
            from occurring, an "X-RHN-Redirect: 0" header is passed along with the
            request.  This function will return apache.HTTP_OK if everything 
            succeeded, otherwise it will return an appropriate HTTP error code.
        """
        
        # Add a special header which will tell the server not to send us any
        # more redirects.

        headers = rhnFlags.get('outputTransportOptions')
        headers[rhnConstants.HEADER_RHN_REDIRECT] = '0'

        log_debug(4, "Added X-RHN-Redirect header to outputTransportOptions:", \
                     headers)

        # Reset the existing connection and reconnect to the RHN parent server.

        self.responseContext.clear()
        self._connectToParent()

        # We'll just call serverCommo once more.  The X-RHN-Redirect constant
        # will prevent us from falling into an infinite loop.  Only GETs are 
        # redirected, so we can safely pass an empty string in as the request
        # body.

        status = self._serverCommo('')

        # This little hack isn't pretty, but lets us normalize our result code.

        if status == apache.OK:
            status = apache.HTTP_OK

        return status
开发者ID:pombredanne,项目名称:spacewalk-1,代码行数:35,代码来源:rhnRedirect.py

示例12: update

def update(server_id, action_id, data={}):
    log_debug(3, server_id, action_id)

    action_status = rhnFlags.get('action_status')

    if action_status == 3:
        # Action failed
        kickstart_state = 'failed'
        next_action_type = None
    else:
        kickstart_state = 'deployed'

        #This is horrendous, but in order to fix it I would have to change almost all of the
        #actions code, which we don't have time to do for the 500 beta. --wregglej
        try: 
            ks_session_type = server_kickstart.get_kickstart_session_type(server_id, action_id)
        except rhnException, re:
            ks_session_type = None

        if ks_session_type is None:
            next_action_type = "None"            
        elif ks_session_type == 'para_guest':
            next_action_type = 'kickstart_guest.initiate'
        else:
            next_action_type = 'kickstart.initiate'
开发者ID:bjmingyang,项目名称:spacewalk,代码行数:25,代码来源:packages.py

示例13: process

    def process(self):
        log_debug(3)
        # nice thing that req has a read() method, so it makes it look just
        # like an fd
        try:
            fd = self.input.decode(self.req)
        except IOError: # client timed out
            return apache.HTTP_BAD_REQUEST

        # Read the data from the request
        _body = fd.read()
        fd.close()

        # In this case, we talk to a client (maybe through a proxy)
        # make sure we have something to decode
        if _body is None or len(_body) == 0:
            return apache.HTTP_BAD_REQUEST

        # Decode the request; avoid logging crappy responses
        try:
            params, method = self.decode(_body)
        except rpclib.ResponseError:
            log_error("Got bad XML-RPC blob of len = %d" % len(_body))
            return apache.HTTP_BAD_REQUEST
        else:
            if params is None:
                params = ()
        # make the actual function call and return the result
        return self.call_function(method, params)
开发者ID:bjmingyang,项目名称:spacewalk,代码行数:29,代码来源:apacheRequest.py

示例14: updateDist

    def updateDist(self, kwargs, username, password):
        log_debug(3)
        self._auth(username, password)
        
        if not kwargs.get('release'):
            raise rhnFault(23, "Insufficient data, release missing to update dist", explain=0)
                     
        if not kwargs.get('os'):
            kwargs['os'] = 'Red Hat Linux'

        if kwargs.get('channel_id') is None:
            # Missing stuff
            raise rhnFault(23, "Insufficient data, channel_id missing to update dist", explain=0)

        if kwargs.get('channel_arch_id') is None:
            # Missing stuff
            raise rhnFault(23, "Insufficient data, channel arch id missing to update dist", explain=0)
            
        try:
            rhnSQL.execute("""
            insert into rhnDistChannelMap 
                (channel_id, channel_arch_id, os, release)
            values
                (:channel_id, :channel_arch_id, :os, :release)
            """, kwargs)
        except rhnSQL.SQLError, e:
            rhnSQL.rollback()
            raise rhnFault(23, str(e.args[1]), explain=0 )
开发者ID:bjmingyang,项目名称:spacewalk,代码行数:28,代码来源:channel.py

示例15: dump_errata

    def dump_errata(self, errata, verify_errata=False):
        log_debug(2)

        errata_hash = {} 
        if verify_errata:
            h = self.get_errata_statement()
            for erratum in errata:
                errata_id = self._get_item_id('rhn-erratum-', str(erratum),
                                              3004, "Wrong erratum name %s")
                if errata_hash.has_key(errata_id):
                    # Already verified
                    continue
                h.execute(errata_id=errata_id)
                row = h.fetchone_dict()
                if not row:
                    # XXX Silently ignore it?
                    raise rhnFault(3005, "No such erratum %s" % erratum)
                # Saving the row, it's handy later when we create the iterator
                errata_hash[errata_id] = row
        else:
            for erratum in errata:
                errata_hash[erratum['errata_id']] = erratum

        self._write_dump(ErrataDumper, params=errata_hash.values())
        return 0
开发者ID:bjmingyang,项目名称:spacewalk,代码行数:25,代码来源:dumper.py


注:本文中的spacewalk.common.log_debug函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。