本文整理汇总了Python中subscription_manager.repolib.RepoActionInvoker.get_repos方法的典型用法代码示例。如果您正苦于以下问题:Python RepoActionInvoker.get_repos方法的具体用法?Python RepoActionInvoker.get_repos怎么用?Python RepoActionInvoker.get_repos使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类subscription_manager.repolib.RepoActionInvoker
的用法示例。
在下文中一共展示了RepoActionInvoker.get_repos方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_repos
# 需要导入模块: from subscription_manager.repolib import RepoActionInvoker [as 别名]
# 或者: from subscription_manager.repolib.RepoActionInvoker import get_repos [as 别名]
def test_get_repos(self):
self._stub_content(include_content_access=True)
repo_action_invoker = RepoActionInvoker()
repos = repo_action_invoker.get_repos()
self.assertEqual(2, len(repos), 'Should produce two repos')
matching_repos = [repo for repo in repos if repo.id == 'a_test_repo']
self.assertEqual(1, len(matching_repos), 'Should only produce one repo for "a_test_repo"')
repo = matching_repos[0]
certpath = repo.get('sslclientcert')
self.assertNotEqual(certpath, self.stub_content_access_cert.path)
示例2: _set_enable_for_yum_repositories
# 需要导入模块: from subscription_manager.repolib import RepoActionInvoker [as 别名]
# 或者: from subscription_manager.repolib.RepoActionInvoker import get_repos [as 别名]
def _set_enable_for_yum_repositories(setting, *repo_ids):
invoker = RepoActionInvoker()
repos = invoker.get_repos()
repos_to_change = []
for r in repo_ids:
matches = set([repo for repo in repos if fnmatch.fnmatch(repo.id, r)])
repos_to_change.extend(matches)
if len(repos_to_change) == 0:
return 0
# The cache should be primed at this point by the invoker.get_repos()
cache = inj.require(inj.OVERRIDE_STATUS_CACHE)
identity = inj.require(inj.IDENTITY)
cp_provider = inj.require(inj.CP_PROVIDER)
if identity.is_valid() and cp_provider.get_consumer_auth_cp().supports_resource('content_overrides'):
overrides = [{'contentLabel': repo.id, 'name': 'enabled', 'value': setting} for repo in repos_to_change]
cp = cp_provider.get_consumer_auth_cp()
results = cp.setContentOverrides(identity.uuid, overrides)
cache = inj.require(inj.OVERRIDE_STATUS_CACHE)
# Update the cache with the returned JSON
cache.server_status = results
cache.write_cache()
invoker.update()
else:
for repo in repos_to_change:
repo['enabled'] = setting
repo_file = YumRepoFile()
repo_file.read()
for repo in repos_to_change:
repo_file.update(repo)
repo_file.write()
return len(repos_to_change)
示例3: test_get_repos_empty_dirs
# 需要导入模块: from subscription_manager.repolib import RepoActionInvoker [as 别名]
# 或者: from subscription_manager.repolib.RepoActionInvoker import get_repos [as 别名]
def test_get_repos_empty_dirs(self):
repo_action_invoker = RepoActionInvoker()
repos = repo_action_invoker.get_repos()
if repos:
self.fail("get_repos() should have returned an empty set but did not.")
示例4: test_get_repos
# 需要导入模块: from subscription_manager.repolib import RepoActionInvoker [as 别名]
# 或者: from subscription_manager.repolib.RepoActionInvoker import get_repos [as 别名]
def test_get_repos(self):
self._stub_content()
repo_action_invoker = RepoActionInvoker()
repos = repo_action_invoker.get_repos()
if len(repos) == 0:
self.fail("get_repos() should have a set of Repo's, but the set is empty.")