本文整理汇总了Python中subscription_manager.injection.require函数的典型用法代码示例。如果您正苦于以下问题:Python require函数的具体用法?Python require怎么用?Python require使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了require函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self):
self.identity = inj.require(inj.IDENTITY)
self.cp_provider = inj.require(inj.CP_PROVIDER)
self.ent_dir = inj.require(inj.ENT_DIR)
self.pool_cache = inj.require(inj.POOL_STATUS_CACHE)
self.pooltype_map = {}
self.update()
开发者ID:jstavel,项目名称:subscription-manager,代码行数:7,代码来源:cache.py
示例2: __init__
def __init__(self, cache_only=False, apply_overrides=True):
self.identity = inj.require(inj.IDENTITY)
# These should probably move closer their use
self.ent_dir = inj.require(inj.ENT_DIR)
self.prod_dir = inj.require(inj.PROD_DIR)
self.ent_source = ent_cert.EntitlementDirEntitlementSource()
self.cp_provider = inj.require(inj.CP_PROVIDER)
self.uep = self.cp_provider.get_consumer_auth_cp()
self.manage_repos = 1
self.apply_overrides = apply_overrides
self.manage_repos = manage_repos_enabled()
self.release = None
self.overrides = {}
self.override_supported = False
try:
self.override_supported = bool(self.identity.is_valid() and self.uep and self.uep.supports_resource('content_overrides'))
except socket.error as e:
# swallow the error to fix bz 1298327
log.exception(e)
pass
self.written_overrides = WrittenOverrideCache()
# FIXME: empty report at the moment, should be changed to include
# info about updated repos
self.report = RepoActionReport()
self.report.name = "Repo updates"
# If we are not registered, skip trying to refresh the
# data from the server
if not self.identity.is_valid():
return
# NOTE: if anything in the RepoActionInvoker init blocks, and it
# could, yum could still block. The closest thing to an
# event loop we have is the while True: sleep() in lock.py:Lock.acquire()
# Only attempt to update the overrides if they are supported
# by the server.
if self.override_supported:
self.written_overrides._read_cache()
try:
override_cache = inj.require(inj.OVERRIDE_STATUS_CACHE)
except KeyError:
override_cache = OverrideStatusCache()
if cache_only:
status = override_cache._read_cache()
else:
status = override_cache.load_status(self.uep, self.identity.uuid)
for item in status or []:
# Don't iterate through the list
if item['contentLabel'] not in self.overrides:
self.overrides[item['contentLabel']] = {}
self.overrides[item['contentLabel']][item['name']] = item['value']
开发者ID:belonesox,项目名称:subscription-manager,代码行数:60,代码来源:repolib.py
示例3: __init__
def __init__(self, uep=None):
uep = uep or inj.require(inj.CP_PROVIDER).get_consumer_auth_cp()
self.identity = inj.require(inj.IDENTITY)
if self.identity.is_valid():
self.prod_status_cache = inj.require(inj.PROD_STATUS_CACHE)
self.prod_status = self.prod_status_cache.load_status(
uep, self.identity.uuid)
开发者ID:Januson,项目名称:subscription-manager,代码行数:7,代码来源:validity.py
示例4: __init__
def __init__(self, report=None):
self.cp_provider = inj.require(inj.CP_PROVIDER)
self.uep = self.cp_provider.get_consumer_auth_cp()
self.ent_dir = inj.require(inj.ENT_DIR)
self.identity = require(IDENTITY)
self.report = EntCertUpdateReport()
self.content_access_cache = inj.require(inj.CONTENT_ACCESS_CACHE)
开发者ID:Januson,项目名称:subscription-manager,代码行数:7,代码来源:entcertlib.py
示例5: get_filtered_pools_list
def get_filtered_pools_list(self, active_on, incompatible,
overlapping, uninstalled, text, filter_string, future=None, after_date=None):
"""
Used for CLI --available filtering
cuts down on api calls
"""
self.all_pools = {}
self.compatible_pools = {}
if active_on and overlapping:
self.sorter = ComplianceManager(active_on)
elif not active_on and overlapping:
self.sorter = require(CERT_SORTER)
if incompatible:
for pool in list_pools(require(CP_PROVIDER).get_consumer_auth_cp(),
self.identity.uuid, active_on=active_on,
filter_string=filter_string, future=future, after_date=after_date):
self.compatible_pools[pool['id']] = pool
else: # --all has been used
for pool in list_pools(require(CP_PROVIDER).get_consumer_auth_cp(),
self.identity.uuid, list_all=True, active_on=active_on,
filter_string=filter_string, future=future, after_date=after_date):
self.all_pools[pool['id']] = pool
return self._filter_pools(incompatible, overlapping, uninstalled, False, text)
开发者ID:Januson,项目名称:subscription-manager,代码行数:25,代码来源:managerlib.py
示例6: __init__
def __init__(self):
self.release_status_cache = inj.require(inj.RELEASE_STATUS_CACHE)
self._expansion = None
self.identity = inj.require(inj.IDENTITY)
self.cp_provider = inj.require(inj.CP_PROVIDER)
开发者ID:candlepin,项目名称:subscription-manager,代码行数:7,代码来源:repolib.py
示例7: list_pools
def list_pools(uep, consumer_uuid, list_all=False, active_on=None, filter_string=None, future=None,
after_date=None):
"""
Wrapper around the UEP call to fetch pools, which forces a facts update
if anything has changed before making the request. This ensures the
rule checks server side will have the most up to date info about the
consumer possible.
"""
# client tells service 'look for facts again'
# if service finds new facts:
# -emit a signal?
# - or just update properties
# - and set a 'been_synced' property to False
# client waits for facts check to finish
# if no changes or been_synced=True, continue
# if changes or unsynced:
# subman updates candlepin with the latest version of services GetFacts() [blocking]
# when finished, subman emit's 'factsSyncFinished'
# - then service flops 'been_synced' property
# -or- subman calls 'here_are_the_latest_facts_to_the_server()' on service
# then service flops 'been_synced' property
# subman gets signal that props changed, and that been_synced is now true
# since it's been synced, then subman continues
require(FACTS).update_check(uep, consumer_uuid)
profile_mgr = cache.ProfileManager()
profile_mgr.update_check(uep, consumer_uuid)
owner = uep.getOwner(consumer_uuid)
ownerid = owner['key']
return uep.getPoolsList(consumer=consumer_uuid, listAll=list_all,
active_on=active_on, owner=ownerid, filter_string=filter_string, future=future,
after_date=after_date)
开发者ID:Januson,项目名称:subscription-manager,代码行数:35,代码来源:managerlib.py
示例8: perform
def perform(self):
mgr = inj.require(inj.INSTALLED_PRODUCTS_MANAGER)
consumer_identity = inj.require(inj.IDENTITY)
ret = mgr.update_check(self.uep, consumer_identity.uuid)
self.report._status = ret
return self.report
开发者ID:MichaelMraka,项目名称:subscription-manager,代码行数:7,代码来源:installedproductslib.py
示例9: __init__
def __init__(self, uep):
"""
Initialization of Unregister instance
"""
self.identity = inj.require(inj.IDENTITY)
self.cp_provider = inj.require(inj.CP_PROVIDER)
self.uep = uep
开发者ID:Lorquas,项目名称:subscription-manager,代码行数:7,代码来源:unregister.py
示例10: __init__
def __init__(self, on_date=None):
self.cp_provider = inj.require(inj.CP_PROVIDER)
self.product_dir = inj.require(inj.PROD_DIR)
self.entitlement_dir = inj.require(inj.ENT_DIR)
self.identity = inj.require(inj.IDENTITY)
self.on_date = on_date
self.load()
开发者ID:Januson,项目名称:subscription-manager,代码行数:7,代码来源:cert_sorter.py
示例11: get_installed_product_status
def get_installed_product_status(product_directory, entitlement_directory, uep):
"""
Returns the Installed products and their subscription states
"""
product_status = []
sorter = require(CERT_SORTER)
calculator = require(PRODUCT_DATE_RANGE_CALCULATOR, uep)
for installed_product in sorter.installed_products:
product_cert = sorter.installed_products[installed_product]
for product in product_cert.products:
begin = ""
end = ""
prod_status_range = calculator.calculate(product.id)
if prod_status_range:
# Format the date in user's local time as the date
# range is returned in GMT.
begin = format_date(prod_status_range.begin())
end = format_date(prod_status_range.end())
data = (product.name,
installed_product,
product.version,
",".join(product.architectures),
sorter.get_status(product.id),
sorter.reasons.get_product_reasons(product),
begin,
end)
product_status.append(data)
return product_status
开发者ID:aweiteka,项目名称:subscription-manager,代码行数:31,代码来源:managerlib.py
示例12: __init__
def __init__(self, facts):
super(SystemFactsDialog, self).__init__()
#self.consumer = consumer
self.identity = inj.require(inj.IDENTITY)
self.cp_provider = inj.require(inj.CP_PROVIDER)
self.facts = facts
self.connect_signals({
"on_system_facts_dialog_delete_event": self._hide_callback,
"on_close_button_clicked": self._hide_callback,
"on_facts_update_button_clicked": self._update_facts_callback
})
# Set up the model
self.facts_store = ga_Gtk.TreeStore(str, str)
self.facts_view.set_model(self.facts_store)
# Set up columns on the view
self._add_column(_("Fact"), 0)
self._add_column(_("Value"), 1)
# set up the signals from the view
self.facts_view.connect("row_activated",
widgets.expand_collapse_on_row_activated_callback)
开发者ID:belonesox,项目名称:subscription-manager,代码行数:25,代码来源:factsgui.py
示例13: setUp
def setUp(self):
super(TestPoolTypeCache, self).setUp()
self.cp_provider = inj.require(inj.CP_PROVIDER)
self.cp_provider.consumer_auth_cp = Mock()
self.cp = self.cp_provider.consumer_auth_cp
certs = [StubEntitlementCertificate(StubProduct('pid1'), pool=StubPool('someid'))]
self.ent_dir = StubEntitlementDirectory(certificates=certs)
self.pool_cache = inj.require(inj.POOL_STATUS_CACHE)
self.pool_cache.write_cache = Mock()
开发者ID:Lorquas,项目名称:subscription-manager,代码行数:9,代码来源:test_cache.py
示例14: __init__
def __init__(self, cache_only=False, apply_overrides=True):
self.identity = inj.require(inj.IDENTITY)
# These should probably move closer their use
self.ent_dir = inj.require(inj.ENT_DIR)
self.prod_dir = inj.require(inj.PROD_DIR)
self.ent_source = ent_cert.EntitlementDirEntitlementSource()
self.cp_provider = inj.require(inj.CP_PROVIDER)
self.uep = self.cp_provider.get_consumer_auth_cp()
self.manage_repos = 1
self.apply_overrides = apply_overrides
if CFG.has_option('rhsm', 'manage_repos'):
self.manage_repos = int(CFG.get('rhsm', 'manage_repos'))
self.release = None
self.overrides = {}
self.override_supported = bool(self.identity.is_valid() and self.uep and self.uep.supports_resource('content_overrides'))
self.written_overrides = WrittenOverrideCache()
# FIXME: empty report at the moment, should be changed to include
# info about updated repos
self.report = RepoActionReport()
self.report.name = "Repo updates"
# If we are not registered, skip trying to refresh the
# data from the server
if not self.identity.is_valid():
return
# Only attempt to update the overrides if they are supported
# by the server.
if self.override_supported:
self.written_overrides._read_cache()
try:
override_cache = inj.require(inj.OVERRIDE_STATUS_CACHE)
except KeyError:
override_cache = OverrideStatusCache()
if cache_only:
status = override_cache._read_cache()
else:
status = override_cache.load_status(self.uep, self.identity.uuid)
for item in status or []:
# Don't iterate through the list
if item['contentLabel'] not in self.overrides:
self.overrides[item['contentLabel']] = {}
self.overrides[item['contentLabel']][item['name']] = item['value']
message = "Release API is not supported by the server. Using default."
try:
result = self.uep.getRelease(self.identity.uuid)
self.release = result['releaseVer']
except RemoteServerException, e:
log.debug(message)
开发者ID:stbenjam,项目名称:subscription-manager,代码行数:56,代码来源:repolib.py
示例15: update_product_manager
def update_product_manager(self):
if self.is_registered():
cp_provider = inj.require(inj.CP_PROVIDER)
consumer_identity = inj.require(inj.IDENTITY)
try:
self.installed_mgr.update_check(cp_provider.get_consumer_auth_cp(),
consumer_identity.uuid)
except RestlibException:
# Invalid consumer certificate
pass
开发者ID:Januson,项目名称:subscription-manager,代码行数:10,代码来源:cert_sorter.py
示例16: clean_all_data
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()
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(PROD_STATUS_CACHE).delete_cache()
require(OVERRIDE_STATUS_CACHE).delete_cache()
require(RELEASE_STATUS_CACHE).delete_cache()
RepoActionInvoker.delete_repo_file()
log.info("Cleaned local data")
开发者ID:belonesox,项目名称:subscription-manager,代码行数:54,代码来源:managerlib.py
示例17: __init__
def __init__(self):
ent_dir = inj.require(inj.ENT_DIR)
prod_dir = inj.require(inj.PROD_DIR)
self.product_tags = prod_dir.get_provided_tags()
# populate from ent certs
self._entitlements = []
for ent_cert in ent_dir.list_valid():
self._entitlements.append(
EntitlementCertEntitlement.from_ent_cert(ent_cert))
开发者ID:MichaelMraka,项目名称:subscription-manager,代码行数:11,代码来源:ent_cert.py
示例18: __init__
def __init__(self):
self.identity = require(IDENTITY)
self.cp_provider = require(CP_PROVIDER)
self.update()
self.product_dir = inj.require(inj.PROD_DIR)
self.entitlement_dir = inj.require(inj.ENT_DIR)
self.certlib = CertLib(uep=self.cp_provider.get_consumer_auth_cp())
self.cs = require(CERT_SORTER)
开发者ID:tkolhar,项目名称:subscription-manager,代码行数:11,代码来源:managergui.py
示例19: __init__
def __init__(self):
self.identity = require(IDENTITY)
self.cp_provider = require(CP_PROVIDER)
self.update()
self.product_dir = inj.require(inj.PROD_DIR)
self.entitlement_dir = inj.require(inj.ENT_DIR)
self.certlib = EntCertActionInvoker()
self.overrides = Overrides()
self.cs = require(CERT_SORTER)
开发者ID:Januson,项目名称:subscription-manager,代码行数:12,代码来源:managergui.py
示例20: get_sys_purpose_store
def get_sys_purpose_store():
"""
:return: Returns a singleton instance of the syspurpose store if it was imported.
Otherwise None.
"""
global store
if store is not None:
return store
elif SyncedStore is not None:
uep = inj.require(inj.CP_PROVIDER).get_consumer_auth_cp()
uuid = inj.require(inj.IDENTITY).uuid
store = SyncedStore(uep, consumer_uuid=uuid)
return store
开发者ID:Januson,项目名称:subscription-manager,代码行数:13,代码来源:syspurposelib.py
注:本文中的subscription_manager.injection.require函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论