• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python common.log_debug函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: uploadPackageBySession

 def uploadPackageBySession(self, session_string, info):
     log_debug(3)
     channels = info.get('channels', [])
     force = info.get('force', 0)
     org_id, force = rhnPackageUpload.authenticate_session(session_string,
         channels=channels, force=force)
     return self._uploadPackage(channels, org_id, force, info)
开发者ID:bjmingyang,项目名称:spacewalk,代码行数:7,代码来源:packages.py


示例17: getUserGroupsFromUserInstance

def getUserGroupsFromUserInstance(user_instance):
    log_debug(4, user_instance.getid())
    user = user_instance

    if not user:
        log_debug("null user")
        raise rhnFault(2)

    #Don't need to check the password, the session should have already been checked.
    
    # Get the org id
    org_id = user.contact['org_id']
    user_id = user.getid()
    h = rhnSQL.prepare("""
        select ugt.label
          from rhnUserGroupType ugt,
               rhnUserGroup ug,
               rhnUserGroupMembers ugm
         where ugm.user_id = :user_id
               and ugm.user_group_id = ug.id
               and ug.group_type = ugt.id
    """)
    h.execute(user_id=user_id)
    groups = []
    while 1:
        row = h.fetchone_dict()
        if not row:
            break
        groups.append(row['label'])
    return groups, org_id, user_id 
开发者ID:bjmingyang,项目名称:spacewalk,代码行数:30,代码来源:userAuth.py


示例18: getAnyChecksum

    def getAnyChecksum(self, info, username = None, password = None, session = None, is_source = 0):
        """ returns checksum info of available packages
            also does an existance check on the filesystem.
        """
        log_debug(3)

        pkg_infos = info.get('packages')
        channels = info.get('channels', [])
        force = info.get('force', 0)
        orgid = info.get('org_id')

        if orgid == 'null':
            null_org=1
        else:
            null_org=None

        if not session:
            org_id, force = rhnPackageUpload.authenticate(username, password,
                                                          channels=channels,
                                                          null_org=null_org,
                                                          force=force)
        else:
            try:
                org_id, force = rhnPackageUpload.authenticate_session(
                    session, channels=channels, null_org=null_org, force=force)
            except rhnSession.InvalidSessionError:
                raise rhnFault(33)
            except rhnSession.ExpiredSessionError:
                raise rhnFault(34)

        if is_source:
            ret = self._getSourcePackageChecksum(org_id, pkg_infos)
        else:
            ret = self._getPackageChecksum(org_id, pkg_infos)
        return ret
开发者ID:bjmingyang,项目名称:spacewalk,代码行数:35,代码来源:packages.py


示例19: auth_proxy

def auth_proxy():
    """ Authenticates a proxy carrying a clients request. For a valid or
        unsigned request, this function returns 1 (OK), otherwise it raises
        rhnFault
    
        NOTE: X-RHN-Proxy-Auth described in proxy/broker/rhnProxyAuth.py
    """

    log_debug(3)
    headers = rhnFlags.get('outputTransportOptions')
    if not rhnFlags.test('X-RHN-Proxy-Auth'):
        # No auth information; decline any action
        log_debug(4, "declined proxy authentication")
        headers['X-RHN-Proxy-Auth-Error'] = '%s:%s' % (
            1003, _("declined proxy authentication"))
        raise rhnFault(1003) # Invalid session key

    # NOTE:
    #   - < v3.1 RHN proxies send only 1 token in this header
    #   - > v3.1: we send the route of the requests via multiple tokens
    #     "token1:hostname1,token2:hostname2" the first tuple is the first
    #     proxy hit.
    
    tokens = string.split(rhnFlags.get('X-RHN-Proxy-Auth'), ',')
    tokens = filter(lambda token: token, tokens)

    for auth_token in tokens:
        _verifyProxyAuthToken(auth_token)

    # if no rhnFault was raised then the tokens all passed
    return 1
开发者ID:bjmingyang,项目名称:spacewalk,代码行数:31,代码来源:apacheAuth.py


示例20: __init__

 def __init__(self):
     log_debug(3)
     RPC_Base.__init__(self)        
     self.functions.append('uploadPackageInfo')
     self.functions.append('uploadPackageInfoBySession')
     self.functions.append('uploadSourcePackageInfo')
     self.functions.append('uploadSourcePackageInfoBySession')
     self.functions.append('listChannel')
     self.functions.append('listChannelBySession')
     self.functions.append('listChannelSource')
     self.functions.append('listChannelSourceBySession')
     self.functions.append('listMissingSourcePackages')
     self.functions.append('listMissingSourcePackagesBySession')
     self.functions.append('uploadPackage')
     self.functions.append('uploadPackageBySession')
     self.functions.append('channelPackageSubscription')
     self.functions.append('channelPackageSubscriptionBySession')
     self.functions.append('no_op')
     self.functions.append('test_login')
     self.functions.append('test_new_login')
     self.functions.append('test_check_session')
     self.functions.append('login')
     self.functions.append('check_session')
     self.functions.append('getPackageChecksum')
     self.functions.append('getPackageChecksumBySession')
     self.functions.append('getSourcePackageChecksum')
     self.functions.append('getSourcePackageChecksumBySession')
     # old MD5 compatibility functions
     self.functions.append('getPackageMD5sum')
     self.functions.append('getPackageMD5sumBySession')
     self.functions.append('getSourcePackageMD5sum')
     self.functions.append('getSourcePackageMD5sumBySession')
开发者ID:bjmingyang,项目名称:spacewalk,代码行数:32,代码来源:packages.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python common.log_error函数代码示例发布时间:2022-05-27
下一篇:
Python datamodel.dmarray函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap