本文整理汇总了Python中pulp.server.managers.factory.repo_group_manager函数的典型用法代码示例。如果您正苦于以下问题:Python repo_group_manager函数的具体用法?Python repo_group_manager怎么用?Python repo_group_manager使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了repo_group_manager函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: post
def post(self, request):
"""
Create a repo group from the data passed in the body.
:param request: WSGI request object
:type request: django.core.handlers.wsgi.WSGIRequest
:return: Response containing a serialized dict of the new repo group
:rtype: django.http.HttpResponse
:raises pulp_exceptions.MissingValue: if required values are not passed into the body
:raises pulp_exceptions.InvalidValue: if invalid values are passed into the body
"""
group_data = request.body_as_json
group_id = group_data.pop('id', None)
if group_id is None:
raise pulp_exceptions.MissingValue(['id'])
display_name = group_data.pop('display_name', None)
description = group_data.pop('description', None)
repo_ids = group_data.pop('repo_ids', None)
notes = group_data.pop('notes', None)
distributors = group_data.pop('distributors', None)
if group_data:
raise pulp_exceptions.InvalidValue(group_data.keys())
# Create the repo group
manager = managers_factory.repo_group_manager()
args = [group_id, display_name, description, repo_ids, notes]
kwargs = {'distributor_list': distributors}
group = manager.create_and_configure_repo_group(*args, **kwargs)
group = _add_group_link(group)
group['distributors'] = distributors or []
response = generate_json_response_with_pulp_encoder(group)
return generate_redirect_response(response, group['_href'])
示例2: POST
def POST(self):
group_data = self.params()
group_id = group_data.pop('id', None)
if group_id is None:
raise pulp_exceptions.MissingValue(['id'])
display_name = group_data.pop('display_name', None)
description = group_data.pop('description', None)
repo_ids = group_data.pop('repo_ids', None)
notes = group_data.pop('notes', None)
distributors = group_data.pop('distributors', None)
if group_data:
raise pulp_exceptions.InvalidValue(group_data.keys())
# Create the repo group
manager = managers_factory.repo_group_manager()
args = [group_id, display_name, description, repo_ids, notes]
kwargs = {'distributor_list': distributors}
weight = pulp_config.config.getint('tasks', 'create_weight')
tags = [resource_tag(dispatch_constants.RESOURCE_REPOSITORY_GROUP_TYPE, group_id)]
call_request = CallRequest(manager.create_and_configure_repo_group, args, kwargs, weight=weight,
tags=tags)
call_request.creates_resource(dispatch_constants.RESOURCE_REPOSITORY_GROUP_TYPE, group_id)
group = execution.execute_sync(call_request)
group.update(serialization.link.child_link_obj(group['id']))
group['distributors'] = distributors or []
return self.created(group['_href'], group)
示例3: setUp
def setUp(self):
super(RepoGroupDistributorTests, self).setUp()
mock_plugins.install()
self.manager = manager_factory.repo_group_manager()
self.distributor_manager = manager_factory.repo_group_distributor_manager()
示例4: POST
def POST(self, repo_group_id):
criteria = Criteria.from_client_input(self.params().get('criteria', {}))
manager = managers_factory.repo_group_manager()
manager.unassociate(repo_group_id, criteria)
collection = RepoGroup.get_collection()
group = collection.find_one({'id': repo_group_id})
return self.ok(group['repo_ids'])
示例5: DELETE
def DELETE(self, repo_group_id):
manager = managers_factory.repo_group_manager()
tags = [resource_tag(dispatch_constants.RESOURCE_REPOSITORY_GROUP_TYPE, repo_group_id)]
call_request = CallRequest(manager.delete_repo_group,
[repo_group_id],
tags=tags)
call_request.deletes_resource(dispatch_constants.RESOURCE_REPOSITORY_GROUP_TYPE, repo_group_id)
return execution.execute_ok(self, call_request)
示例6: setUp
def setUp(self):
super(RepoGroupDistributorManagerTests, self).setUp()
mock_plugins.install()
self.group_manager = manager_factory.repo_group_manager()
self.distributor_manager = manager_factory.repo_group_distributor_manager()
self.group_id = 'test-group'
self.group_manager.create_repo_group(self.group_id)
示例7: PUT
def PUT(self, repo_group_id):
update_data = self.params()
manager = managers_factory.repo_group_manager()
tags = [resource_tag(dispatch_constants.RESOURCE_REPOSITORY_GROUP_TYPE, repo_group_id)]
call_request = CallRequest(manager.update_repo_group,
args=[repo_group_id],
kwargs=update_data,
tags=tags)
call_request.updates_resource(dispatch_constants.RESOURCE_REPOSITORY_GROUP_TYPE, repo_group_id)
group = execution.execute(call_request)
group.update(serialization.link.current_link_obj())
return self.ok(group)
示例8: setUp
def setUp(self):
super(RepoGroupPublishManagerTests, self).setUp()
mock_plugins.install()
self.group_manager = manager_factory.repo_group_manager()
self.distributor_manager = manager_factory.repo_group_distributor_manager()
self.publish_manager = manager_factory.repo_group_publish_manager()
self.group_id = 'publish-group'
self.group_manager.create_repo_group(self.group_id)
self.distributor_id = 'publish-dist'
self.distributor_manager.add_distributor(self.group_id, 'mock-group-distributor', {}, distributor_id=self.distributor_id)
示例9: POST
def POST(self, repo_group_id):
criteria = Criteria.from_client_input(self.params().get('criteria', {}))
manager = managers_factory.repo_group_manager()
tags = [resource_tag(dispatch_constants.RESOURCE_REPOSITORY_GROUP_TYPE, repo_group_id),
action_tag('repo_group_unassociate')]
call_request = CallRequest(manager.unassociate,
[repo_group_id, criteria],
tags=tags)
call_request.updates_resource(dispatch_constants.RESOURCE_REPOSITORY_GROUP_TYPE, repo_group_id)
execution.execute(call_request)
collection = RepoGroup.get_collection()
group = collection.find_one({'id': repo_group_id})
return self.ok(group['repo_ids'])
示例10: setUp
def setUp(self):
super(RepoGroupPublishConduitTests, self).setUp()
mock_plugins.install()
manager_factory.initialize()
self.group_manager = manager_factory.repo_group_manager()
self.distributor_manager = manager_factory.repo_group_distributor_manager()
self.group_id = 'conduit-group'
self.distributor_id = 'conduit-distributor'
self.group_manager.create_repo_group(self.group_id)
self.distributor_manager.add_distributor(self.group_id, 'mock-group-distributor', {}, distributor_id=self.distributor_id)
self.conduit = RepoGroupPublishConduit(self.group_id, self.distributor_id)
示例11: delete
def delete(self, request, repo_group_id):
"""
Delete the specified repo group.
:param request: WSGI request object
:type request: django.core.handlers.wsgi.WSGIRequest
:param repo_group_id: id of repo group to delete
:type repo_group_id: str
:return: An empty response
:rtype: django.http.HttpResponse
"""
manager = managers_factory.repo_group_manager()
manager.delete_repo_group(repo_group_id)
return generate_json_response(None)
示例12: put
def put(self, request, repo_group_id):
"""
Update the specified repo group with body data.
:param request: WSGI request object
:type request: django.core.handlers.wsgi.WSGIRequest
:param repo_group_id: id of repo group to update
:type repo_group_id: str
:return: Response containing a serialized dict of the modified repo group
:rtype: django.http.HttpResponse
"""
update_data = request.body_as_json
manager = managers_factory.repo_group_manager()
group = manager.update_repo_group(repo_group_id, **update_data)
group = _add_group_link(group)
return generate_json_response_with_pulp_encoder(group)
示例13: _
RepoDistributor.get_collection().remove({'repo_id' : repo_id}, safe=True)
RepoImporter.get_collection().remove({'repo_id' : repo_id}, safe=True)
RepoSyncResult.get_collection().remove({'repo_id' : repo_id}, safe=True)
RepoPublishResult.get_collection().remove({'repo_id' : repo_id}, safe=True)
# Remove all associations from the repo
RepoContentUnit.get_collection().remove({'repo_id' : repo_id}, safe=True)
except Exception, e:
msg = _('Error updating one or more database collections while removing repo [%(r)s]')
msg = msg % {'r': repo_id}
logger.exception(msg)
error_tuples.append(e)
# remove the repo from any groups it was a member of
group_manager = manager_factory.repo_group_manager()
group_manager.remove_repo_from_groups(repo_id)
if len(error_tuples) > 0:
pe = PulpExecutionException()
pe.child_exceptions = error_tuples
raise pe
@staticmethod
def update_repo(repo_id, delta):
"""
Updates metadata about the given repository. Only the following
fields may be updated through this call:
* display_name
* description
示例14: DELETE
def DELETE(self, repo_group_id):
manager = managers_factory.repo_group_manager()
result = manager.delete_repo_group(repo_group_id)
return self.ok(result)
示例15: test_factory
def test_factory(self):
try:
managers_factory.repo_group_manager()
except:
self.fail(traceback.format_exc())