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


Python certlib.ConsumerIdentity类代码示例

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


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

示例1: update

def update(conduit):
    """ 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.certlib import ConsumerIdentity

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

    # if we have a RHIC, it's ok to call RepoLib without a ConsumerId or UEP
    if RhicCertificate.existsAndValid():
        rl = RepoLib()
        rl.update()
        return

    try:
        ConsumerIdentity.read().getConsumerId()
    except Exception:
        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 = RepoLib(uep=uep)
    rl.update()
开发者ID:splice,项目名称:subscription-manager,代码行数:35,代码来源:subscription-manager.py

示例2: update

def update(conduit):
    """ 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.certlib import ConsumerIdentity

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

    try:
        ConsumerIdentity.read().getConsumerId()
    except Exception:
        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 = RepoLib(uep=uep)
    rl.update()
开发者ID:beav,项目名称:subscription-manager,代码行数:29,代码来源:subscription-manager.py

示例3: reload

 def reload(self):
     """
     Check for consumer certificate on disk and update our info accordingly.
     """
     log.debug("Loading consumer info from identity certificates.")
     if not ConsumerIdentity.existsAndValid():
         self.name = None
         self.uuid = None
     else:
         consumer = ConsumerIdentity.read()
         self.name = consumer.getConsumerName()
         self.uuid = consumer.getConsumerId()
开发者ID:bkearney,项目名称:subscription-manager,代码行数:12,代码来源:managergui.py

示例4: setup_plugin

def setup_plugin():
    """
    Setup the plugin based on registration status using the RHSM configuration.
    """
    if not ConsumerIdentity.existsAndValid():
        # not registered
        return
    cfg = plugin.cfg()
    rhsm_conf = Config(RHSM_CONFIG_PATH)
    certificate = ConsumerIdentity.read()
    cfg.messaging.url = 'ssl://%s:5671' % rhsm_conf['server']['hostname']
    cfg.messaging.uuid = 'pulp.agent.%s' % certificate.getConsumerId()
    bundle(certificate)
开发者ID:bbuckingham,项目名称:katello-agent,代码行数:13,代码来源:katelloplugin.py

示例5: send_enabled_report

def send_enabled_report(path=REPOSITORY_PATH):
    """
    Send the enabled repository report.
    :param path: The path to a repository file.
    :type path: str
    """
    if not ConsumerIdentity.existsAndValid():
        # not registered
        return
    try:
        uep = UEP()
        certificate = ConsumerIdentity.read()
        report = EnabledReport(path)
        uep.report_enabled(certificate.getConsumerId(), report.content)
    except Exception, e:
        log.error('send enabled report failed: %s', str(e))
开发者ID:bbuckingham,项目名称:katello-agent,代码行数:16,代码来源:katelloplugin.py

示例6: changed

 def changed(cls, path):
     """
     A change in the rhsm certificate has been detected.
     When deleted: disconnect from qpid.
     When added/updated: reconnect to qpid.
     @param path: The changed file (ignored).
     @type path: str
     """
     log.info('changed: %s', path)
     if ConsumerIdentity.existsAndValid():
         cert = ConsumerIdentity.read()
         cls.bundle(cert)
         uuid = cert.getConsumerId()
         plugin.setuuid(uuid)
     else:
         plugin.setuuid(None)
开发者ID:AdamSaleh,项目名称:katello,代码行数:16,代码来源:katelloplugin.py

示例7: check_status

def check_status(force_signal):

    if force_signal is not None:
        debug("forcing status signal from cli arg")
        return force_signal

    if ClassicCheck().is_registered_with_classic():
        debug("System is already registered to another entitlement system")
        return RHN_CLASSIC

    if not ConsumerIdentity.existsAndValid():
        debug("The system is not currently registered.")
        return RHSM_REGISTRATION_REQUIRED

    facts = Facts()
    sorter = CertSorter(certdirectory.ProductDirectory(),
            certdirectory.EntitlementDirectory(), facts.get_facts())

    if len(sorter.unentitled_products.keys()) > 0 or len(sorter.expired_products.keys()) > 0:
        debug("System has one or more certificates that are not valid")
        debug(sorter.unentitled_products.keys())
        debug(sorter.expired_products.keys())
        return RHSM_EXPIRED
    elif len(sorter.partially_valid_products) > 0:
        debug("System has one or more partially entitled products")
        return RHSM_PARTIALLY_VALID
    elif in_warning_period(sorter):
        debug("System has one or more entitlements in their warning period")
        return RHSM_WARNING
    else:
        debug("System entitlements appear valid")
        return RHSM_VALID
开发者ID:beav,项目名称:subscription-manager,代码行数:32,代码来源:rhsm_d.py

示例8: shouldAppear

 def shouldAppear(self):
     """
     Indicates to firstboot whether to show this screen.  In this case
     we want to skip over this screen if there is already an identity
     certificate on the machine (most likely laid down in a kickstart).
     """
     return not ConsumerIdentity.existsAndValid()
开发者ID:beav,项目名称:subscription-manager,代码行数:7,代码来源:firstboot_base.py

示例9: consumer_id

 def consumer_id(self):
     """
     Get the current consumer ID
     :return: The unique consumer ID of the currently running agent
     :rtype:  str
     """
     certificate = ConsumerIdentity.read()
     return certificate.getConsumerId()
开发者ID:bbuckingham,项目名称:katello-agent,代码行数:8,代码来源:katelloplugin.py

示例10: init

 def init(cls):
     """
     Start path monitor to track changes in the
     rhsm identity certificate.
     """
     path = ConsumerIdentity.certpath()
     cls.pmon.add(path, cls.changed)
     cls.pmon.start()
开发者ID:AdamSaleh,项目名称:katello,代码行数:8,代码来源:katelloplugin.py

示例11: __init__

    def __init__(self):
        self.create_uep(cert_file=ConsumerIdentity.certpath(),
                        key_file=ConsumerIdentity.keypath())

        self.create_content_connection()
        # we don't know the user/pass yet, so no point in
        # creating an admin uep till we need it
        self.admin_uep = None

        self.product_dir = ProductDirectory()
        self.entitlement_dir = EntitlementDirectory()
        self.certlib = CertLib(uep=self.uep)

        self.product_monitor = file_monitor.Monitor(self.product_dir.path)
        self.entitlement_monitor = file_monitor.Monitor(
                self.entitlement_dir.path)
        self.identity_monitor = file_monitor.Monitor(ConsumerIdentity.PATH)
开发者ID:bkearney,项目名称:subscription-manager,代码行数:17,代码来源:managergui.py

示例12: _do_update

 def _do_update(self):
     profile_mgr = ProfileManager()
     try:
         consumer = ConsumerIdentity.read()
     except IOError:
         return 0
     consumer_uuid = consumer.getConsumerId()
     return profile_mgr.update_check(self.uep, consumer_uuid)
开发者ID:bkearney,项目名称:subscription-manager,代码行数:8,代码来源:cache.py

示例13: main

def main(options, log):
    if not ConsumerIdentity.existsAndValid():
        log.error('Either the consumer is not registered or the certificates' +
                  ' are corrupted. Certificate update using daemon failed.')
        sys.exit(-1)
    print _('Updating entitlement certificates & repositories')

    try:
        uep = connection.UEPConnection(cert_file=ConsumerIdentity.certpath(),
                                       key_file=ConsumerIdentity.keypath())
        mgr = certmgr.CertManager(uep=uep)
        updates = mgr.update(options.autoheal)

        print _('%d updates required') % updates
        print _('done')
    except connection.ExpiredIdentityCertException, e:
        log.critical(_("Your identity certificate has expired"))
        raise e
开发者ID:tkolhar,项目名称:subscription-manager,代码行数:18,代码来源:rhsmcertd-worker.py

示例14: warnOrGiveUsageMessage

def warnOrGiveUsageMessage(conduit):
    """ either output a warning, or a usage message """
    msg = ""
    # TODO: refactor so there are not two checks for this
    if os.getuid() != 0:
        return
    try:
        try:
            ConsumerIdentity.read().getConsumerId()
            entdir = EntitlementDirectory()
            if len(entdir.listValid()) == 0:
                msg = no_subs_warning
            else:
                msg = repo_usage_message
        except:
            msg = not_registered_warning
    finally:
        conduit.info(2, msg)
开发者ID:bkearney,项目名称:subscription-manager,代码行数:18,代码来源:subscription-manager.py

示例15: __init__

    def __init__(self):
        self.create_uep(cert_file=ConsumerIdentity.certpath(), key_file=ConsumerIdentity.keypath())

        self.create_content_connection()
        # we don't know the user/pass yet, so no point in
        # creating an admin uep till we need it
        self.admin_uep = None

        self.product_dir = ProductDirectory()
        self.entitlement_dir = EntitlementDirectory()
        self.certlib = CertLib(uep=self.uep)

        self.product_monitor = file_monitor.Monitor(self.product_dir.path)
        self.entitlement_monitor = file_monitor.Monitor(self.entitlement_dir.path)
        self.identity_monitor = file_monitor.Monitor(ConsumerIdentity.PATH)

        # connect handlers to refresh the cached data when we notice a change.
        # do this before any other handlers might connect
        self.product_monitor.connect("changed", lambda monitor: self.product_dir.refresh())
        self.entitlement_monitor.connect("changed", lambda monitor: self.entitlement_dir.refresh())
开发者ID:splice,项目名称:subscription-manager,代码行数:20,代码来源:managergui.py


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