本文整理汇总了Python中subscription_manager.certlib.ConsumerIdentity.keypath方法的典型用法代码示例。如果您正苦于以下问题:Python ConsumerIdentity.keypath方法的具体用法?Python ConsumerIdentity.keypath怎么用?Python ConsumerIdentity.keypath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类subscription_manager.certlib.ConsumerIdentity
的用法示例。
在下文中一共展示了ConsumerIdentity.keypath方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: update
# 需要导入模块: from subscription_manager.certlib import ConsumerIdentity [as 别名]
# 或者: from subscription_manager.certlib.ConsumerIdentity import keypath [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()
示例2: update
# 需要导入模块: from subscription_manager.certlib import ConsumerIdentity [as 别名]
# 或者: from subscription_manager.certlib.ConsumerIdentity import keypath [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()
示例3: __init__
# 需要导入模块: from subscription_manager.certlib import ConsumerIdentity [as 别名]
# 或者: from subscription_manager.certlib.ConsumerIdentity import keypath [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)
示例4: main
# 需要导入模块: from subscription_manager.certlib import ConsumerIdentity [as 别名]
# 或者: from subscription_manager.certlib.ConsumerIdentity import keypath [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
示例5: __init__
# 需要导入模块: from subscription_manager.certlib import ConsumerIdentity [as 别名]
# 或者: from subscription_manager.certlib.ConsumerIdentity import keypath [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())
示例6: _read_rhn_proxy_settings
# 需要导入模块: from subscription_manager.certlib import ConsumerIdentity [as 别名]
# 或者: from subscription_manager.certlib.ConsumerIdentity import keypath [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())
示例7: main
# 需要导入模块: from subscription_manager.certlib import ConsumerIdentity [as 别名]
# 或者: from subscription_manager.certlib.ConsumerIdentity import keypath [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
示例8: set_connection_info
# 需要导入模块: from subscription_manager.certlib import ConsumerIdentity [as 别名]
# 或者: from subscription_manager.certlib.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):
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()
示例9: upload_package_profile
# 需要导入模块: from subscription_manager.certlib import ConsumerIdentity [as 别名]
# 或者: from subscription_manager.certlib.ConsumerIdentity import keypath [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()
示例10:
# 需要导入模块: from subscription_manager.certlib import ConsumerIdentity [as 别名]
# 或者: from subscription_manager.certlib.ConsumerIdentity import keypath [as 别名]
_ = 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
REGISTER_ERROR = _("<b>Unable to register the system.</b>") + \
示例11: __init__
# 需要导入模块: from subscription_manager.certlib import ConsumerIdentity [as 别名]
# 或者: from subscription_manager.certlib.ConsumerIdentity import keypath [as 别名]
def __init__(self):
key = ConsumerIdentity.keypath()
cert = ConsumerIdentity.certpath()
UEPConnection.__init__(self, key_file=key, cert_file=cert)
示例12: update
# 需要导入模块: from subscription_manager.certlib import ConsumerIdentity [as 别名]
# 或者: from subscription_manager.certlib.ConsumerIdentity import keypath [as 别名]
def update(self):
self.create_uep(cert_file=ConsumerIdentity.certpath(),
key_file=ConsumerIdentity.keypath())
self.content_connection = self._create_content_connection()