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


Python ConsumerIdentity.certpath方法代码示例

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


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

示例1: update

# 需要导入模块: from subscription_manager.certlib import ConsumerIdentity [as 别名]
# 或者: from subscription_manager.certlib.ConsumerIdentity import certpath [as 别名]
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,代码行数:37,代码来源:subscription-manager.py

示例2: update

# 需要导入模块: from subscription_manager.certlib import ConsumerIdentity [as 别名]
# 或者: from subscription_manager.certlib.ConsumerIdentity import certpath [as 别名]
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,代码行数:31,代码来源:subscription-manager.py

示例3: init

# 需要导入模块: from subscription_manager.certlib import ConsumerIdentity [as 别名]
# 或者: from subscription_manager.certlib.ConsumerIdentity import certpath [as 别名]
 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,代码行数:10,代码来源:katelloplugin.py

示例4: init_plugin

# 需要导入模块: from subscription_manager.certlib import ConsumerIdentity [as 别名]
# 或者: from subscription_manager.certlib.ConsumerIdentity import certpath [as 别名]
def init_plugin():
    """
    Initialize the plugin.
    Called (once) immediately after the plugin is loaded.
     - setup plugin configuration.
     - send an initial repository enabled report.
     - setup path monitoring.
    """
    setup_plugin()
    send_enabled_report()
    path = ConsumerIdentity.certpath()
    path_monitor.add(path, registration_changed)
    path_monitor.add(REPOSITORY_PATH, send_enabled_report)
    path_monitor.start()
开发者ID:bbuckingham,项目名称:katello-agent,代码行数:16,代码来源:katelloplugin.py

示例5: __init__

# 需要导入模块: from subscription_manager.certlib import ConsumerIdentity [as 别名]
# 或者: from subscription_manager.certlib.ConsumerIdentity import certpath [as 别名]
    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,代码行数:19,代码来源:managergui.py

示例6: main

# 需要导入模块: from subscription_manager.certlib import ConsumerIdentity [as 别名]
# 或者: from subscription_manager.certlib.ConsumerIdentity import certpath [as 别名]
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,代码行数:20,代码来源:rhsmcertd-worker.py

示例7: __init__

# 需要导入模块: from subscription_manager.certlib import ConsumerIdentity [as 别名]
# 或者: from subscription_manager.certlib.ConsumerIdentity import certpath [as 别名]
    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,代码行数:22,代码来源:managergui.py

示例8: _read_rhn_proxy_settings

# 需要导入模块: from subscription_manager.certlib import ConsumerIdentity [as 别名]
# 或者: from subscription_manager.certlib.ConsumerIdentity import certpath [as 别名]
    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.uep = rhsm.connection.UEPConnection(
            host=cfg.get('server', 'hostname'),
            ssl_port=int(cfg.get('server', 'port')),
            handler=cfg.get('server', 'prefix'),
            proxy_hostname=cfg.get('server', 'proxy_hostname'),
            proxy_port=cfg.get('server', 'proxy_port'),
            proxy_user=cfg.get('server', 'proxy_user'),
            proxy_password=cfg.get('server', 'proxy_password'),
            username=None, password=None,
            cert_file=ConsumerIdentity.certpath(),
            key_file=ConsumerIdentity.keypath())
开发者ID:bkearney,项目名称:subscription-manager,代码行数:43,代码来源:rhsm_login.py

示例9: main

# 需要导入模块: from subscription_manager.certlib import ConsumerIdentity [as 别名]
# 或者: from subscription_manager.certlib.ConsumerIdentity import certpath [as 别名]
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.GoneException, ge:
        uuid = ConsumerIdentity.read().getConsumerId()
        if ge.deleted_id == uuid:
            log.critical(_("This consumer's profile has been deleted from the server. It's local certificates will now be archived"))
            managerlib.clean_all_data()
            log.critical(_("Certificates archived to '/etc/pki/consumer.old'. Contact your system administrator if you need more information."))
        else:
            raise ge
开发者ID:bkearney,项目名称:subscription-manager,代码行数:25,代码来源:rhsmcertd-worker.py

示例10: set_connection_info

# 需要导入模块: from subscription_manager.certlib import ConsumerIdentity [as 别名]
# 或者: from subscription_manager.certlib.ConsumerIdentity import certpath [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):

        cfg = rhsm.config.initConfig()

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

        self.server_hostname = host or cfg.get('server', 'hostname')
        self.server_port = ssl_port or cfg.get_int('server', 'port')
        self.server_prefix = handler or cfg.get('server', 'prefix')
        self.proxy_hostname = proxy_hostname_arg or remove_scheme(cfg.get('server', 'proxy_hostname'))
        self.proxy_port = proxy_port_arg or cfg.get_int('server', 'proxy_port')
        self.proxy_user = proxy_user_arg or cfg.get('server', 'proxy_user')
        self.proxy_password = proxy_password_arg or cfg.get('server', 'proxy_password')
        self.clean()
开发者ID:tkolhar,项目名称:subscription-manager,代码行数:26,代码来源:cp_provider.py

示例11: upload_package_profile

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

示例12:

# 需要导入模块: from subscription_manager.certlib import ConsumerIdentity [as 别名]
# 或者: from subscription_manager.certlib.ConsumerIdentity import certpath [as 别名]
import gettext
_ = lambda x: gettext.ldgettext("rhsm", x)
gettext.textdomain("rhsm")
gtk.glade.bindtextdomain("rhsm")
gtk.glade.textdomain("rhsm")

log = logging.getLogger('rhsm-app.' + __name__)

prefix = os.path.dirname(__file__)
VALID_IMG = os.path.join(prefix, "data/icons/valid.svg")
INVALID_IMG = os.path.join(prefix, "data/icons/invalid.svg")

# An implied Katello environment which we can't actual register to.
LIBRARY_ENV_NAME = "library"

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

CFG = config.initConfig()

import threading
import Queue

import gobject

CREDENTIALS_PAGE = 0
PROGRESS_PAGE = 1
OWNER_SELECT_PAGE = 2
ENVIRONMENT_SELECT_PAGE = 3
CHOOSE_SERVER_PAGE = 4
开发者ID:bkearney,项目名称:subscription-manager,代码行数:32,代码来源:registergui.py

示例13: __init__

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

示例14: EntitlementDirectory

# 需要导入模块: from subscription_manager.certlib import ConsumerIdentity [as 别名]
# 或者: from subscription_manager.certlib.ConsumerIdentity import certpath [as 别名]
                writer.write(key, cert)
            except:
                raise

        rhiclib.cleanExpiredCerts(ProductDirectory(), EntitlementDirectory(), facts.to_dict())

        sys.exit(0)

    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.GoneException, ge:
        uuid = ConsumerIdentity.read().getConsumerId()
        if ge.deleted_id == uuid:
            log.critical(_("This consumer's profile has been deleted from the server. It's local certificates will now be archived"))
            managerlib.clean_all_data()
            log.critical(_("Certificates archived to '/etc/pki/consumer.old'. Contact your system administrator if you need more information."))
        else:
            raise ge
开发者ID:splice,项目名称:subscription-manager,代码行数:32,代码来源:rhsmcertd-worker.py

示例15: update

# 需要导入模块: from subscription_manager.certlib import ConsumerIdentity [as 别名]
# 或者: from subscription_manager.certlib.ConsumerIdentity import certpath [as 别名]
 def update(self):
     self.create_uep(cert_file=ConsumerIdentity.certpath(),
                     key_file=ConsumerIdentity.keypath())
     self.content_connection = self._create_content_connection()
开发者ID:bkearney,项目名称:subscription-manager,代码行数:6,代码来源:managergui.py


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