本文整理汇总了Python中pulp.server.managers.factory.consumer_group_query_manager函数的典型用法代码示例。如果您正苦于以下问题:Python consumer_group_query_manager函数的具体用法?Python consumer_group_query_manager怎么用?Python consumer_group_query_manager使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了consumer_group_query_manager函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: unbind
def unbind(group_id, repo_id, distributor_id, options):
"""
Unbind the members of the specified consumer group.
:param group_id: A consumer group ID.
:type group_id: str
:param repo_id: A repository ID.
:type repo_id: str
:param distributor_id: A distributor ID.
:type distributor_id: str
:param options: Bind options passed to the agent handler.
:type options: dict
:return: TaskResult containing the ids of all the spawned tasks & bind errors
:rtype: TaskResult
"""
manager = manager_factory.consumer_group_query_manager()
group = manager.get_group(group_id)
bind_errors = []
additional_tasks = []
for consumer_id in group['consumer_ids']:
try:
report = unbind_task(consumer_id, repo_id, distributor_id, options)
if report:
additional_tasks.extend(report.spawned_tasks)
except PulpException, e:
# Log a message so that we can debug but don't throw
_logger.warn(e)
bind_errors.append(e)
except Exception, e:
bind_errors.append(e)
示例2: POST
def POST(self, consumer_group_id):
criteria = Criteria.from_client_input(self.params().get('criteria', {}))
manager = managers_factory.consumer_group_manager()
manager.unassociate(consumer_group_id, criteria)
query_manager = managers_factory.consumer_group_query_manager()
group = query_manager.get_group(consumer_group_id)
return self.ok(group['consumer_ids'])
示例3: verify_group_resources
def verify_group_resources(group_id, repo_id, distributor_id):
"""
Confirm the group, repository, and distributor exist.
:param group_id: The consumer group id to verify the existence of
:type group_id: str
:param repo_id: The repository id to confirm the existence of
:type repo_id: str
:param distributor_id: The distributor id to confirm the existence of on the repository
:type distributor_id: str
:return: A dictionary of the missing resources
:rtype: dict
"""
missing_resources = {}
group_manager = factory.consumer_group_query_manager()
repo_manager = factory.repo_query_manager()
distributor_manager = factory.repo_distributor_manager()
try:
group_manager.get_group(group_id)
except pulp_exceptions.MissingResource:
missing_resources['group_id'] = group_id
repo = repo_manager.find_by_id(repo_id)
if repo is None:
missing_resources['repo_id'] = repo_id
try:
distributor_manager.get_distributor(repo_id, distributor_id)
except pulp_exceptions.MissingResource:
missing_resources['distributor_id'] = distributor_id
return missing_resources
示例4: consumer_group_bind_itinerary
def consumer_group_bind_itinerary(group_id, repo_id, distributor_id, notify_agent, binding_config, agent_options):
"""
Bind the members of the specified consumer group.
:param group_id: A consumer group ID.
:type group_id: str
:param repo_id: A repository ID.
:type repo_id: str
:param distributor_id: A distributor ID.
:type distributor_id: str
:param agent_options: Bind options passed to the agent handler.
:type agent_options: dict
:param notify_agent: indicates if the agent should be sent a message about the new binding
:type notify_agent: bool
:param binding_config: configuration options to use when generating the payload for this binding
:type binding_config: dict
:return: A list of call_requests.
:rtype list
"""
call_requests = []
manager = managers.consumer_group_query_manager()
group = manager.get_group(group_id)
for consumer_id in group["consumer_ids"]:
itinerary = bind_itinerary(
consumer_id=consumer_id,
repo_id=repo_id,
distributor_id=distributor_id,
notify_agent=notify_agent,
binding_config=binding_config,
agent_options=agent_options,
)
call_requests.extend(itinerary)
return call_requests
示例5: POST
def POST(self, consumer_group_id):
criteria = Criteria.from_client_input(self.params().get('criteria', {}))
manager = managers_factory.consumer_group_manager()
tags = [resource_tag(dispatch_constants.RESOURCE_CONSUMER_GROUP_TYPE, consumer_group_id),
action_tag('consumer_group_unassociate')]
call_request = CallRequest(manager.unassociate,
[consumer_group_id, criteria],
tags=tags)
call_request.updates_resource(dispatch_constants.RESOURCE_CONSUMER_GROUP_TYPE, consumer_group_id)
execution.execute(call_request)
query_manager = managers_factory.consumer_group_query_manager()
group = query_manager.get_group(consumer_group_id)
return self.ok(group['consumer_ids'])
示例6: uninstall_content
def uninstall_content(consumer_group_id, units, options):
"""
Create an itinerary for consumer group content uninstallation.
:param consumer_group_id: unique id of the consumer group
:type consumer_group_id: str
:param units: units to uninstall
:type units: list or tuple
:param options: options to pass to the uninstall manager
:type options: dict or None
:return: Details of the subtasks that were executed
:rtype: TaskResult
"""
consumer_group = managers.consumer_group_query_manager().get_group(consumer_group_id)
agent_manager = managers.consumer_agent_manager()
return _process_group(consumer_group, PLP0022, {'group_id': consumer_group_id},
agent_manager.uninstall_content, units, options)
示例7: update_content
def update_content(consumer_group_id, units, options):
"""
Create an itinerary for consumer group content update.
:param consumer_group_id: unique id of the consumer group
:type consumer_group_id: str
:param units: units to update
:type units: list or tuple
:param options: options to pass to the update manager
:type options: dict or None
:return: Details of the subtasks that were executed
:rtype: TaskResult
"""
consumer_group = manager_factory.consumer_group_query_manager().get_group(consumer_group_id)
agent_manager = manager_factory.consumer_agent_manager()
return ConsumerGroupManager.process_group(consumer_group, error_codes.PLP0021,
{'group_id': consumer_group_id},
agent_manager.update_content, units, options)
示例8: post
def post(self, request, consumer_group_id):
"""
Unassociate a consumer from the group.
:param request: WSGI request object
:type request: django.core.handlers.wsgi.WSGIRequest
:param consumer_group_id: id for the requested group
:type consumer_group_id: str
:return: Response containing consumers bound to the group
:rtype: django.http.HttpResponse
"""
params = request.body_as_json
criteria = Criteria.from_client_input(params.get('criteria', {}))
manager = factory.consumer_group_manager()
manager.unassociate(consumer_group_id, criteria)
query_manager = factory.consumer_group_query_manager()
group = query_manager.get_group(consumer_group_id)
return generate_json_response_with_pulp_encoder(group['consumer_ids'])
示例9: consumer_group_content_uninstall_itinerary
def consumer_group_content_uninstall_itinerary(consumer_group_id, units, options):
"""
Create an itinerary for consumer group content uninstallation.
:param consumer_group_id: unique id of the consumer group
:type consumer_group_id: str
:param units: units to uninstall
:type units: list or tuple
:param options: options to pass to the uninstall manager
:type options: dict or None
:return: list of call requests
:rtype: list
"""
consumer_group = managers.consumer_group_query_manager().get_group(consumer_group_id)
consumer_group_call_requests_list = []
for consumer_id in consumer_group['consumer_ids']:
consumer_call_requests = consumer_content_uninstall_itinerary(consumer_id, units, options)
consumer_group_call_requests_list.extend(consumer_call_requests)
return consumer_group_call_requests_list
示例10: consumer_group_unbind_itinerary
def consumer_group_unbind_itinerary(group_id, repo_id, distributor_id, options):
"""
Unbind the members of the specified consumer group.
:param group_id: A consumer group ID.
:type group_id: str
:param repo_id: A repository ID.
:type repo_id: str
:param distributor_id: A distributor ID.
:type distributor_id: str
:param options: Bind options passed to the agent handler.
:type options: dict
:return: A list of call_requests.
:rtype list
"""
call_requests = []
manager = managers.consumer_group_query_manager()
group = manager.get_group(group_id)
for consumer_id in group["consumer_ids"]:
itinerary = unbind_itinerary(consumer_id, repo_id, distributor_id, options)
call_requests.extend(itinerary)
return call_requests
示例11: bind
def bind(group_id, repo_id, distributor_id, notify_agent, binding_config, agent_options):
"""
Bind the members of the specified consumer group.
:param group_id: A consumer group ID.
:type group_id: str
:param repo_id: A repository ID.
:type repo_id: str
:param distributor_id: A distributor ID.
:type distributor_id: str
:param agent_options: Bind options passed to the agent handler.
:type agent_options: dict
:param notify_agent: indicates if the agent should be sent a message about the new binding
:type notify_agent: bool
:param binding_config: configuration options to use when generating the payload for this
binding
:type binding_config: dict
:return: Details of the subtasks that were executed
:rtype: TaskResult
"""
manager = manager_factory.consumer_group_query_manager()
group = manager.get_group(group_id)
bind_errors = []
additional_tasks = []
for consumer_id in group['consumer_ids']:
try:
report = bind_task(consumer_id, repo_id, distributor_id, notify_agent,
binding_config, agent_options)
if report.spawned_tasks:
additional_tasks.extend(report.spawned_tasks)
except PulpException, e:
# Log a message so that we can debug but don't throw
_logger.debug(e)
bind_errors.append(e)
except Exception, e:
_logger.exception(e)
# Don't do anything else since we still want to process all the other consumers
bind_errors.append(e)
示例12: __init__
def __init__(self):
super(ConsumerGroupSearch, self).__init__(
managers_factory.consumer_group_query_manager().find_by_criteria)