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

Python config.initUp2dateConfig函数代码示例

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

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



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

示例1: testConfigRuntimeStore

    def testConfigRuntimeStore(self):
        "Verify that values Config['value'] are set for runtime only and not saved"
        cfg = config.initUp2dateConfig(test_up2date)
        cfg['blippy12345'] = "wantafreehat?"
        cfg.save()
        # cfg is a fairly persistent singleton, blow it awy to get a new referece
        del config.cfg

        cfg2 = config.initUp2dateConfig(test_up2date)
        # if this returns a value, it means we saved the config file...
        assert cfg2['blippy12345'] == None
开发者ID:mcalmer,项目名称:spacewalk,代码行数:11,代码来源:testConfig.py


示例2: __init__

    def __init__(self):
        UserDict.UserDict.__init__(self)
        self.missingCaps = {}
        #self.populate()
#        self.validate()
        self.neededCaps = neededCaps
        self.cfg = config.initUp2dateConfig()
开发者ID:Bearlock,项目名称:spacewalk,代码行数:7,代码来源:capabilities.py


示例3: _read_rhn_proxy_settings

    def _read_rhn_proxy_settings(self):
        if not rhn_config:
            return
        # Read and store rhn-setup's proxy settings, as they have been set
        # on the prior screen (which is owned by rhn-setup)
        up2date_cfg = rhn_config.initUp2dateConfig()
        cfg = rhsm.config.initConfig()

        if up2date_cfg["enableProxy"]:
            proxy = up2date_cfg["httpProxy"]
            if proxy:
                # Remove any URI scheme provided
                proxy = remove_scheme(proxy)
                try:
                    host, port = proxy.split(":")
                    cfg.set("server", "proxy_hostname", host)
                    cfg.set("server", "proxy_port", port)
                except ValueError:
                    cfg.set("server", "proxy_hostname", proxy)
                    cfg.set("server", "proxy_port", rhsm.config.DEFAULT_PROXY_PORT)
            if up2date_cfg["enableProxyAuth"]:
                cfg.set("server", "proxy_user", up2date_cfg["proxyUser"])
                cfg.set("server", "proxy_password", up2date_cfg["proxyPassword"])
        else:
            cfg.set("server", "proxy_hostname", "")
            cfg.set("server", "proxy_port", "")
            cfg.set("server", "proxy_user", "")
            cfg.set("server", "proxy_password", "")

        cfg.save()
        self.backend.cp_provider.set_connection_info()
开发者ID:ggainey,项目名称:subscription-manager,代码行数:31,代码来源:rhsm_login.py


示例4: setUp

    def setUp(self):
        self.__setupData()
        import testutils

        testutils.setupConfig("8.0-workstation-i386-1")
        self.cfg = config.initUp2dateConfig(test_up2date)
        self.origversion = self.cfg["versionOverride"]
开发者ID:kidaa30,项目名称:spacewalk,代码行数:7,代码来源:testUp2dateAuth.py


示例5: get_up2date_config

 def get_up2date_config(self):
     if self._up2date_config is None:
         self._up2date_config = initUp2dateConfig()
     if not hasattr(self._up2date_config, '__getitem__'):
         # Old interface
         self._up2date_config = OldUp2dateConfig(self._up2date_config)
     return self._up2date_config
开发者ID:colloquium,项目名称:spacewalk,代码行数:7,代码来源:osad.py


示例6: _read_rhn_proxy_settings

    def _read_rhn_proxy_settings(self):
        # Read and store rhn-setup's proxy settings, as they have been set
        # on the prior screen (which is owned by rhn-setup)
        up2date_cfg = config.initUp2dateConfig()
        cfg = rhsm.config.initConfig()

        if up2date_cfg['enableProxy']:
            proxy = up2date_cfg['httpProxy']
            if proxy:
                # Remove any URI scheme provided
                proxy = remove_scheme(proxy)
                try:
                    host, port = proxy.split(':')
                    cfg.set('server', 'proxy_hostname', host)
                    cfg.set('server', 'proxy_port', port)
                except ValueError:
                    cfg.set('server', 'proxy_hostname', proxy)
                    cfg.set('server', 'proxy_port',
                            rhsm.config.DEFAULT_PROXY_PORT)
            if up2date_cfg['enableProxyAuth']:
                cfg.set('server', 'proxy_user', up2date_cfg['proxyUser'])
                cfg.set('server', 'proxy_password',
                        up2date_cfg['proxyPassword'])
        else:
            cfg.set('server', 'proxy_hostname', '')
            cfg.set('server', 'proxy_port', '')
            cfg.set('server', 'proxy_user', '')
            cfg.set('server', 'proxy_password', '')

        cfg.save()
        self.backend.cp_provider.set_connection_info()
开发者ID:tkolhar,项目名称:subscription-manager,代码行数:31,代码来源:rhsm_login.py


示例7: apply

    def apply(self, interface, testing=False):
        if testing:
            return RESULT_SUCCESS

        up2DateConfig = config.initUp2dateConfig()
        up2DateConfig.save()
        return RESULT_SUCCESS
开发者ID:pombredanne,项目名称:spacewalk-1,代码行数:7,代码来源:rhn_finish_gui.py


示例8: getChannels

def getChannels(force=None, label_whitelist=None, timeout=None):
    """ return rhnChannelList containing list of channel we are subscribed to """
    cfg = config.initUp2dateConfig()
    global selected_channels
    if not selected_channels and not force:
        selected_channels = rhnChannelList()
        s = rhnserver.RhnServer(timeout=timeout)

        if not up2dateAuth.getSystemId():
            raise up2dateErrors.NoSystemIdError(_("Unable to Locate SystemId"))

        up2dateChannels = s.up2date.listChannels(up2dateAuth.getSystemId())

        for chan in up2dateChannels:
            if label_whitelist and not chan['label'] in label_whitelist:
                continue

            channel = rhnChannel(type = 'up2date', url = config.getServerlURL())
            for key in chan.keys():
                if key == "last_modified":
                    channel['version'] = chan['last_modified']
                else:
                    channel[key] = chan[key]
            selected_channels.addChannel(channel)

    if len(selected_channels.list) == 0:
        raise up2dateErrors.NoChannelsError(_("This system may not be updated until it is associated with a channel."))

    return selected_channels
开发者ID:Bearlock,项目名称:spacewalk,代码行数:29,代码来源:rhnChannel.py


示例9: __init__

    def __init__(self):
        self.cfg = config.initUp2dateConfig()
        self.xmlrpcServerUrl = self.cfg["serverURL"]
        refreshServerList = 0
	if self.cfg["useNoSSLForPackages"]:
            self.httpServerUrls = self.cfg["noSSLServerURL"]
            refreshServerList = 1
	else:
	    self.httpServerUrls = self.cfg["serverURL"]

        if type(self.httpServerUrls) == type(""):
            self.httpServerUrls = [self.httpServerUrls]

        self.serverList = rpcServer.initServerList(self.httpServerUrls)
        # if the list of servers for packages and stuff is different,
        # refresh
        if refreshServerList:
            self.serverList.resetServerList(self.httpServerUrls)

        self.proxyUrl = None
        self.proxyUser = None
        self.proxyPassword = None
        
        if self.cfg["enableProxy"] and up2dateUtils.getProxySetting():
            self.proxyUrl = up2dateUtils.getProxySetting()
            if self.cfg["enableProxyAuth"]:
                if self.cfg["proxyUser"] and self.cfg["proxyPassword"]:
                    self.proxyPassword = self.cfg["proxyPassword"]
                    self.proxyUser = self.cfg["proxyUser"]
开发者ID:ChrisPortman,项目名称:mrepo,代码行数:29,代码来源:up2dateRepo.py


示例10: _rpc_call

 def _rpc_call(self, function_name, params):
     get_server_obj = self.login()
     # Try a couple of times
     cfg = config.initUp2dateConfig()
     for i in range(cfg["networkRetries"]):
         try:
             ret = apply(getattr(get_server_obj, function_name), params)
         except rpclib.ProtocolError, e:
             # We have two codes to check: the HTTP error code, and the
             # combination (failtCode, faultString) encoded in the headers
             # of the request.
             http_error_code = e.errcode
             fault_code, fault_string = rpclib.reportError(e.headers)
             if http_error_code == 401 and fault_code == -34:
                 # Login token expired
                 get_server_obj = self.login(force=1)
                 continue
             if http_error_code == 404 and fault_code == -17:
                 # File not found
                 self.extinctErrorYN = 1
                 return None
             log(-1, "ERROR: http error code :%s; fault code: %s; %s" % (http_error_code, fault_code, fault_string))
             # XXX
             raise
         else:
             return ret
开发者ID:pombredanne,项目名称:spacewalk-1,代码行数:26,代码来源:xmlWireSource.py


示例11: __init__

    def __init__(self, options):
        self.rhncfg = initUp2dateConfig()
        self.rhsmcfg = config.Config(initConfig())

        # Sometimes we need to send up the entire contents of the system id file
        # which is referred to in Satellite 5 nomenclature as a "certificate"
        # although it is not an X509 certificate.
        try:
            self.system_id_contents = open(self.rhncfg["systemIdPath"], 'r').read()
        except IOError:
            system_exit(os.EX_IOERR, _("Could not read legacy system id at %s") % self.rhncfg["systemIdPath"])

        self.system_id = self.get_system_id(self.system_id_contents)

        self.proxy_host = None
        self.proxy_port = None
        self.proxy_user = None
        self.proxy_pass = None

        self.cp = None
        self.db = ProductDatabase()

        self.consumer_id = None

        self.options = options
        self.is_hosted = is_hosted()
开发者ID:Lorquas,项目名称:subscription-manager,代码行数:26,代码来源:migrate.py


示例12: _rpc_call

 def _rpc_call(self, function_name, params):
     get_server_obj = self.login()
     # Try a couple of times
     fault_count = 0
     expired_token = 0
     cfg = config.initUp2dateConfig()
     while fault_count - expired_token < cfg['networkRetries']:
         try:
             ret = getattr(get_server_obj, function_name)(*params)
         except rpclib.xmlrpclib.ProtocolError:
             e = sys.exc_info()[1]
             # We have two codes to check: the HTTP error code, and the
             # combination (failtCode, faultString) encoded in the headers
             # of the request.
             http_error_code = e.errcode
             fault_code, fault_string = rpclib.reportError(e.headers)
             fault_count += 1
             if http_error_code == 401 and fault_code == -34:
                 # Login token expired
                 get_server_obj = self.login(force=1)
                 # allow exactly one respin for expired token
                 expired_token = 1
                 continue
             if http_error_code == 404 and fault_code == -17:
                 # File not found
                 self.extinctErrorYN = 1
                 return None
             log(-1, 'ERROR: http error code :%s; fault code: %s; %s' %
                 (http_error_code, fault_code, fault_string))
             # XXX
             raise
         else:
             return ret
     raise Exception("Failed after multiple attempts!")
开发者ID:BlackSmith,项目名称:spacewalk,代码行数:34,代码来源:xmlWireSource.py


示例13: get_config

def get_config():
    """send back a cross platform structure containing cfg info"""
    global _config
    if not _config:
        _config = config.initUp2dateConfig()
        
    return _config
开发者ID:colloquium,项目名称:spacewalk,代码行数:7,代码来源:rhn-custom-info.py


示例14: _openSocketStream

    def _openSocketStream(self, method, params):
        """Wraps the gzipstream.GzipStream instantiation in a test block so we
           can open normally if stream is not gzipped."""

        stream = None
        retryYN = 0
        wait = 0.33
        lastErrorMsg = ''
        cfg = config.initUp2dateConfig()
        for i in range(cfg['networkRetries']):
            server = self.getServer(retryYN)
            if server is None:
                log2(-1, 2, 'ERROR: server unable to initialize, attempt %s' % i, stream=sys.stderr)
                retryYN = 1
                time.sleep(wait)
                continue
            func = getattr(server, method)
            try:
                stream = func(*params)
                return stream
            except rpclib.xmlrpclib.ProtocolError, e:
                p = tuple(['<the systemid>'] + list(params[1:]))
                lastErrorMsg = 'ERROR: server.%s%s: %s' % (method, p, e)
                log2(-1, 2, lastErrorMsg, stream=sys.stderr)
                retryYN = 1
                time.sleep(wait)
                # do not reraise this exception!
            except (KeyboardInterrupt, SystemExit):
                raise
开发者ID:cliffy94,项目名称:spacewalk,代码行数:29,代码来源:xmlWireSource.py


示例15: __init__

 def __init__(self, proxyHost=None,
              loginInfo=None, cacheObject=None,
              register=None):
     self.cfg = config.initUp2dateConfig()
     rpmSource.PackageSource.__init__(self, cacheObject = cacheObject)
     self._loginInfo=loginInfo
     self.headerCache = cacheObject
     self.pkglists = {}
开发者ID:ChrisPortman,项目名称:mrepo,代码行数:8,代码来源:yumRepo.py


示例16: apply

    def apply(self, interface, testing=False):
        if testing:
            return RESULT_SUCCESS

        up2DateConfig = config.initUp2dateConfig()
        up2DateConfig.save()
        interface.moveToPage(pageNum = len(interface.moduleList))
        return RESULT_JUMP
开发者ID:jdobes,项目名称:spacewalk,代码行数:8,代码来源:rhn_finish_gui.py


示例17: rhn_username

    def rhn_username(self):
        try:
            cfg = config.initUp2dateConfig()

            return rpclib.xmlrpclib.loads(up2dateAuth.getSystemId())[0][0]['username']
        except:
            # ignore any exception and return an empty username
            return ""
开发者ID:Nick-Harvey,项目名称:sosreport,代码行数:8,代码来源:redhat.py


示例18: getVersion

def getVersion():
    '''
    Returns the version of redhat-release rpm
    '''
    cfg = config.initUp2dateConfig()
    if cfg["versionOverride"]:
        return str(cfg["versionOverride"])
    os_release, version, release = _getOSVersionAndRelease()
    return version
开发者ID:m47ik,项目名称:uyuni,代码行数:9,代码来源:up2dateUtils.py


示例19: setUp

    def setUp(self):

        self.defaultServer = testConfig.brokenServer500error
        import testutils
        testutils.setupConfig("fc1-at-pepsi")

        # cant import config until we put the right stuff in place
        self.cfg = config.initUp2dateConfig(test_up2date)
        self.cfg['serverURL'] = self.defaultServer
开发者ID:BlackSmith,项目名称:spacewalk,代码行数:9,代码来源:testRpcServer.py


示例20: _init

def _init():
    cfg = config.initUp2dateConfig()
    cfg_dict = dict(cfg.items())
    server_url = config.getServerlURL()
    cfg_dict['proto'], cfg_dict['server_name'] = utils.parse_url(server_url[0], scheme="https")[:2]
    if len(server_url) > 1:
        cfg_dict['server_list'] = server_url
    local_config.init('rhncfg-client', defaults=cfg_dict)
    set_debug_level(int(local_config.get('debug_level') or 0))
    set_logfile("/var/log/rhncfg-actions")
开发者ID:ggruner,项目名称:spacewalk,代码行数:10,代码来源:configfiles.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python rpcServer.getServer函数代码示例发布时间:2022-05-27
下一篇:
Python up2dateLog.initLog函数代码示例发布时间: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