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


Python ConsumerIdentity.keypath方法代码示例

本文整理汇总了Python中subscription_manager.identity.ConsumerIdentity.keypath方法的典型用法代码示例。如果您正苦于以下问题:Python ConsumerIdentity.keypath方法的具体用法?Python ConsumerIdentity.keypath怎么用?Python ConsumerIdentity.keypath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在subscription_manager.identity.ConsumerIdentity的用法示例。


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

示例1: _update

# 需要导入模块: from subscription_manager.identity import ConsumerIdentity [as 别名]
# 或者: from subscription_manager.identity.ConsumerIdentity import keypath [as 别名]
    def _update(self, cache_only):
        """ update entitlement certificates """
        logger.info(_('Updating Subscription Management repositories.'))

        # XXX: Importing inline as you must be root to read the config file
        from subscription_manager.identity import ConsumerIdentity

        cert_file = str(ConsumerIdentity.certpath())
        key_file = str(ConsumerIdentity.keypath())

        identity = inj.require(inj.IDENTITY)

        # In containers we have no identity, but we may have entitlements inherited
        # from the host, which need to generate a redhat.repo.
        if identity.is_valid():
            try:
                connection.UEPConnection(cert_file=cert_file, key_file=key_file)
            # FIXME: catchall exception
            except Exception:
                # log
                logger.info(_("Unable to connect to Subscription Management Service"))
                return
        else:
            logger.info(_("Unable to read consumer identity"))

        if config.in_container():
            logger.info(_("Subscription Manager is operating in container mode."))

        if not cache_only:
            cert_action_invoker = EntCertActionInvoker()
            cert_action_invoker.update()

        repo_action_invoker = RepoActionInvoker(cache_only=cache_only)
        repo_action_invoker.update()
开发者ID:Lorquas,项目名称:subscription-manager,代码行数:36,代码来源:subscription-manager.py

示例2: update

# 需要导入模块: from subscription_manager.identity import ConsumerIdentity [as 别名]
# 或者: from subscription_manager.identity.ConsumerIdentity import keypath [as 别名]
def update(conduit, cache_only):
    """ update entitlement certificates """
    if os.getuid() != 0:
        conduit.info(3, 'Not root, Subscription Management repositories not updated')
        return
    conduit.info(3, 'Updating Subscription Management repositories.')

    # XXX: Importing inline as you must be root to read the config file
    from subscription_manager.identity import ConsumerIdentity

    cert_file = ConsumerIdentity.certpath()
    key_file = ConsumerIdentity.keypath()

    identity = inj.require(inj.IDENTITY)

    if not identity.is_valid():
        conduit.info(3, "Unable to read consumer identity")
        return

    try:
        uep = connection.UEPConnection(cert_file=cert_file, key_file=key_file)
    #FIXME: catchall exception
    except Exception:
        # log
        conduit.info(2, "Unable to connect to Subscription Management Service")
        return

    rl = RepoActionInvoker(uep=uep, cache_only=cache_only)
    rl.update()
开发者ID:jaredjennings,项目名称:subscription-manager,代码行数:31,代码来源:subscription-manager.py

示例3: set_connection_info

# 需要导入模块: from subscription_manager.identity import ConsumerIdentity [as 别名]
# 或者: from subscription_manager.identity.ConsumerIdentity import keypath [as 别名]
    def set_connection_info(
        self,
        host=None,
        ssl_port=None,
        handler=None,
        cert_file=None,
        key_file=None,
        proxy_hostname_arg=None,
        proxy_port_arg=None,
        proxy_user_arg=None,
        proxy_password_arg=None,
    ):

        self.cert_file = ConsumerIdentity.certpath()
        self.key_file = ConsumerIdentity.keypath()

        # only use what was passed in, let the lowest level deal with
        # no values and look elsewhere for them.
        self.server_hostname = host
        self.server_port = ssl_port
        self.server_prefix = handler
        self.proxy_hostname = proxy_hostname_arg
        self.proxy_port = proxy_port_arg
        self.proxy_user = proxy_user_arg
        self.proxy_password = proxy_password_arg
        self.clean()
开发者ID:jaredjennings,项目名称:subscription-manager,代码行数:28,代码来源:cp_provider.py

示例4: get_manager

# 需要导入模块: from subscription_manager.identity import ConsumerIdentity [as 别名]
# 或者: from subscription_manager.identity.ConsumerIdentity import keypath [as 别名]
def get_manager():
    if 'subscription_manager.action_client' in sys.modules:
        mgr = action_client.ActionClient()
    else:
        # for compatability with subscription-manager > =1.13
        uep = connection.UEPConnection(cert_file=ConsumerIdentity.certpath(),
                                        key_file=ConsumerIdentity.keypath())
        mgr = certmgr.CertManager(uep=uep)
    return mgr
开发者ID:iNecas,项目名称:katello-agent,代码行数:11,代码来源:package_upload.py

示例5: clean_all_data

# 需要导入模块: from subscription_manager.identity import ConsumerIdentity [as 别名]
# 或者: from subscription_manager.identity.ConsumerIdentity import keypath [as 别名]
def clean_all_data(backup=True):
    consumer_dir = cfg.get('rhsm', 'consumerCertDir')
    if backup:
        if consumer_dir[-1] == "/":
            consumer_dir_backup = consumer_dir[0:-1] + ".old"
        else:
            consumer_dir_backup = consumer_dir + ".old"

        # Delete backup dir if it exists:
        shutil.rmtree(consumer_dir_backup, ignore_errors=True)

        # Copy current consumer dir:
        log.debug("Backing up %s to %s.", consumer_dir, consumer_dir_backup)
        shutil.copytree(consumer_dir, consumer_dir_backup)

# FIXME FIXME
    # Delete current consumer certs:
    for path in [ConsumerIdentity.keypath(), ConsumerIdentity.certpath()]:
        if (os.path.exists(path)):
            log.debug("Removing identity cert: %s" % path)
            os.remove(path)

    require(IDENTITY).reload()

    # Delete all entitlement certs rather than the directory itself:
    ent_cert_dir = cfg.get('rhsm', 'entitlementCertDir')
    if os.path.exists(ent_cert_dir):

        for f in glob.glob("%s/*.pem" % ent_cert_dir):
            certpath = os.path.join(ent_cert_dir, f)
            log.debug("Removing entitlement cert: %s" % f)
            os.remove(certpath)
    else:
        log.warn("Entitlement cert directory does not exist: %s" % ent_cert_dir)

    # Subclasses of cache.CacheManager have a @classmethod delete_cache
    # for deleting persistent caches
    cache.ProfileManager.delete_cache()
    cache.InstalledProductsManager.delete_cache()
    if SyncedStore is not None:
        SyncedStore(None).update_cache({})
    # FIXME: implement as dbus client to facts service DeleteCache() once implemented
    # Facts.delete_cache()
    # WrittenOverridesCache is also a subclass of cache.CacheManager, but
    # it is deleted in RepoActionInvoker.delete_repo_file() below.
    # StatusCache subclasses have a a per instance cache varable
    # and delete_cache is an instance method, so we need to call
    # the delete_cache on the instances created in injectioninit.
    require(ENTITLEMENT_STATUS_CACHE).delete_cache()
    require(SYSTEMPURPOSE_COMPLIANCE_STATUS_CACHE).delete_cache()
    require(PROD_STATUS_CACHE).delete_cache()
    require(POOL_STATUS_CACHE).delete_cache()
    require(OVERRIDE_STATUS_CACHE).delete_cache()
    require(RELEASE_STATUS_CACHE).delete_cache()

    RepoActionInvoker.delete_repo_file()
    log.debug("Cleaned local data")
开发者ID:Januson,项目名称:subscription-manager,代码行数:59,代码来源:managerlib.py

示例6: get_candlepin_consumer_connection

# 需要导入模块: from subscription_manager.identity import ConsumerIdentity [as 别名]
# 或者: from subscription_manager.identity.ConsumerIdentity import keypath [as 别名]
    def get_candlepin_consumer_connection(self):
        self.cp_provider = inj.require(inj.CP_PROVIDER)

        connection_info = self._get_connection_info()

        connection_info["cert_file"] = ConsumerIdentity.certpath()
        connection_info["key_file"] = ConsumerIdentity.keypath()

        self.cp_provider.set_connection_info(**connection_info)

        return self.cp_provider.get_consumer_auth_cp()
开发者ID:jaredjennings,项目名称:subscription-manager,代码行数:13,代码来源:migrate.py

示例7: clean_all_data

# 需要导入模块: from subscription_manager.identity import ConsumerIdentity [as 别名]
# 或者: from subscription_manager.identity.ConsumerIdentity import keypath [as 别名]
def clean_all_data(backup=True):
    consumer_dir = cfg.get('rhsm', 'consumerCertDir')
    if backup:
        if consumer_dir[-1] == "/":
            consumer_dir_backup = consumer_dir[0:-1] + ".old"
        else:
            consumer_dir_backup = consumer_dir + ".old"

        # Delete backup dir if it exists:
        shutil.rmtree(consumer_dir_backup, ignore_errors=True)

        # Copy current consumer dir:
        log.info("Backing up %s to %s." % (consumer_dir, consumer_dir_backup))
        shutil.copytree(consumer_dir, consumer_dir_backup)

# FIXME FIXME
    # Delete current consumer certs:
    for path in [ConsumerIdentity.keypath(), ConsumerIdentity.certpath()]:
        if (os.path.exists(path)):
            log.debug("Removing identity cert: %s" % path)
            os.remove(path)

    require(IDENTITY).reload()

    # Delete all entitlement certs rather than the directory itself:
    ent_cert_dir = cfg.get('rhsm', 'entitlementCertDir')
    if os.path.exists(ent_cert_dir):

        for f in glob.glob("%s/*.pem" % ent_cert_dir):
            certpath = os.path.join(ent_cert_dir, f)
            log.debug("Removing entitlement cert: %s" % f)
            os.remove(certpath)
    else:
        log.warn("Entitlement cert directory does not exist: %s" % ent_cert_dir)

    cache.ProfileManager.delete_cache()
    cache.InstalledProductsManager.delete_cache()
    Facts.delete_cache()

    # Must also delete in-memory cache
    require(ENTITLEMENT_STATUS_CACHE).delete_cache()
    require(PROD_STATUS_CACHE).delete_cache()
    require(OVERRIDE_STATUS_CACHE).delete_cache()
    RepoActionInvoker.delete_repo_file()
    log.info("Cleaned local data")
开发者ID:aweiteka,项目名称:subscription-manager,代码行数:47,代码来源:managerlib.py

示例8: __init__

# 需要导入模块: from subscription_manager.identity import ConsumerIdentity [as 别名]
# 或者: from subscription_manager.identity.ConsumerIdentity import keypath [as 别名]
 def __init__(self, oscs, rdb, logger, opts):
     self.oscs = oscs
     self.rdb = rdb
     self.logger = logger
     self.opts = opts
     self.rhsmconfig = rhsm.config.initConfig()
     try:
         self.consumer_key = _read(ConsumerIdentity.keypath())
         self.consumer_cert = _read(ConsumerIdentity.certpath())
     except IOError as ioerr:
         if 2 == ioerr.errno:
             raise SubscriptionManagerNotRegisteredError()
     self.consumer_identity = ConsumerIdentity(self.consumer_key, self.consumer_cert)
     self.consumer_uuid = self.consumer_identity.getConsumerId()
     self.cp_provider = inj.require(inj.CP_PROVIDER)
     self.cp = self.cp_provider.get_consumer_auth_cp()
     # self.ATTR_DEFAULTS = dict([(attr, RepoConf.optionobj(attr).default) for attr in IMPORTANT_ATTRS])
     self._set_attr_defaults()
     self.problem = False
开发者ID:Syba54,项目名称:openshift-extras,代码行数:21,代码来源:reconcile_rhsm_config.py

示例9: __init__

# 需要导入模块: from subscription_manager.identity import ConsumerIdentity [as 别名]
# 或者: from subscription_manager.identity.ConsumerIdentity import keypath [as 别名]
 def __init__(self):
     key = ConsumerIdentity.keypath()
     cert = ConsumerIdentity.certpath()
     UEPConnection.__init__(self, key_file=key, cert_file=cert)
开发者ID:Katello,项目名称:katello-agent,代码行数:6,代码来源:plugin.py

示例10: get_uep

# 需要导入模块: from subscription_manager.identity import ConsumerIdentity [as 别名]
# 或者: from subscription_manager.identity.ConsumerIdentity import keypath [as 别名]
def get_uep():
    key = ConsumerIdentity.keypath()
    cert = ConsumerIdentity.certpath()
    uep = UEPConnection(key_file=key, cert_file=cert)
    return uep
开发者ID:Katello,项目名称:katello-agent,代码行数:7,代码来源:uep.py

示例11: upload_package_profile

# 需要导入模块: from subscription_manager.identity import ConsumerIdentity [as 别名]
# 或者: from subscription_manager.identity.ConsumerIdentity import keypath [as 别名]
def upload_package_profile():
    uep = connection.UEPConnection(cert_file=ConsumerIdentity.certpath(),
                                   key_file=ConsumerIdentity.keypath())
    get_manager().profilelib._do_update()
开发者ID:iNecas,项目名称:katello-agent,代码行数:6,代码来源:package_upload.py


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