本文整理汇总了Python中pulp.server.managers.factory.schedule_manager函数的典型用法代码示例。如果您正苦于以下问题:Python schedule_manager函数的具体用法?Python schedule_manager怎么用?Python schedule_manager使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了schedule_manager函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: PUT
def PUT(self, consumer_id, schedule_id):
consumer_manager = managers.consumer_manager()
consumer_manager.get_consumer(consumer_id)
schedule_data = self.params()
install_options = None
units = schedule_data.pop('units', None)
if 'options' in schedule_data:
install_options = {'options': schedule_data.pop('options')}
schedule_manager = managers.schedule_manager()
tags = [resource_tag(dispatch_constants.RESOURCE_CONSUMER_TYPE, consumer_id),
resource_tag(dispatch_constants.RESOURCE_SCHEDULE_TYPE, schedule_id),
action_tag('update_unit_uninstall_schedule')]
call_request = CallRequest(schedule_manager.update_unit_uninstall_schedule,
[consumer_id, schedule_id, units, install_options, schedule_data],
tags=tags,
archive=True)
call_request.reads_resource(dispatch_constants.RESOURCE_CONSUMER_TYPE, consumer_id)
call_request.updates_resource(dispatch_constants.RESOURCE_SCHEDULE_TYPE, schedule_id)
execution.execute(call_request)
scheduler = dispatch_factory.scheduler()
scheduled_call = scheduler.get(schedule_id)
scheduled_obj = serialization.dispatch.scheduled_unit_management_obj(scheduled_call)
scheduled_obj.update(serialization.link.current_link_obj())
return self.ok(scheduled_obj)
示例2: POST
def POST(self, repo_id, distributor_id):
distributor_manager = manager_factory.repo_distributor_manager()
distributor_manager.get_distributor(repo_id, distributor_id)
schedule_options = self.params()
publish_options = {'override_config': schedule_options.pop('override_config', {})}
schedule_manager = manager_factory.schedule_manager()
resources = {dispatch_constants.RESOURCE_REPOSITORY_TYPE: {repo_id: dispatch_constants.RESOURCE_READ_OPERATION},
dispatch_constants.RESOURCE_REPOSITORY_DISTRIBUTOR_TYPE: {distributor_id: dispatch_constants.RESOURCE_UPDATE_OPERATION}}
weight = pulp_config.config.getint('tasks', 'create_weight')
tags = [resource_tag(dispatch_constants.RESOURCE_REPOSITORY_TYPE, repo_id),
resource_tag(dispatch_constants.RESOURCE_REPOSITORY_DISTRIBUTOR_TYPE, distributor_id),
action_tag('create_publish_schedule')]
call_request = CallRequest(schedule_manager.create_publish_schedule,
[repo_id, distributor_id, publish_options, schedule_options],
resources=resources,
weight=weight,
tags=tags,
archive=True)
schedule_id = execution.execute_sync(call_request)
scheduler = dispatch_factory.scheduler()
schedule = scheduler.get(schedule_id)
obj = serialization.dispatch.scheduled_publish_obj(schedule)
obj.update(serialization.link.child_link_obj(schedule_id))
return self.created(obj['_href'], obj)
示例3: POST
def POST(self, consumer_id):
consumer_manager = managers.consumer_manager()
consumer_manager.get_consumer(consumer_id)
schedule_data = self.params()
units = schedule_data.pop('units', None)
uninstall_options = {'options': schedule_data.pop('options', {})}
if not units:
raise MissingValue(['units'])
schedule_manager = managers.schedule_manager()
weight = pulp_config.config.getint('tasks', 'create_weight')
tags = [resource_tag(dispatch_constants.RESOURCE_CONSUMER_TYPE, consumer_id),
action_tag('create_unit_uninstall_schedule')]
call_request = CallRequest(schedule_manager.create_unit_uninstall_schedule,
[consumer_id, units, uninstall_options, schedule_data],
weight=weight,
tags=tags,
archive=True)
call_request.reads_resource(dispatch_constants.RESOURCE_CONSUMER_TYPE, consumer_id)
schedule_id = execution.execute_sync(call_request)
scheduler = dispatch_factory.scheduler()
scheduled_call = scheduler.get(schedule_id)
scheduled_obj = serialization.dispatch.scheduled_unit_management_obj(scheduled_call)
scheduled_obj.update(serialization.link.child_link_obj(schedule_id))
return self.created(scheduled_obj['_href'], scheduled_obj)
示例4: PUT
def PUT(self, repo_id, distributor_id, schedule_id):
distributor_manager = manager_factory.repo_distributor_manager()
schedule_list = distributor_manager.list_publish_schedules(repo_id, distributor_id)
if schedule_id not in schedule_list:
raise exceptions.MissingResource(repo=repo_id, distributor=distributor_id, publish_schedule=schedule_id)
publish_update = {}
schedule_update = self.params()
if 'override_config' in schedule_update:
publish_update['override_config'] = schedule_update.pop('override_config')
schedule_manager = manager_factory.schedule_manager()
resources = {dispatch_constants.RESOURCE_REPOSITORY_TYPE: {repo_id: dispatch_constants.RESOURCE_READ_OPERATION},
dispatch_constants.RESOURCE_REPOSITORY_DISTRIBUTOR_TYPE: {distributor_id: dispatch_constants.RESOURCE_READ_OPERATION},
dispatch_constants.RESOURCE_SCHEDULE_TYPE: {schedule_id: dispatch_constants.RESOURCE_UPDATE_OPERATION}}
tags = [resource_tag(dispatch_constants.RESOURCE_REPOSITORY_TYPE, repo_id),
resource_tag(dispatch_constants.RESOURCE_REPOSITORY_DISTRIBUTOR_TYPE, distributor_id),
resource_tag(dispatch_constants.RESOURCE_SCHEDULE_TYPE, schedule_id),
action_tag('update_publish_schedule')]
call_request = CallRequest(schedule_manager.update_publish_schedule,
[repo_id, distributor_id, schedule_id, publish_update, schedule_update],
resources=resources,
tags=tags,
archive=True)
execution.execute(call_request)
scheduler = dispatch_factory.scheduler()
schedule = scheduler.get(schedule_id)
obj = serialization.dispatch.scheduled_publish_obj(schedule)
obj.update(serialization.link.current_link_obj())
return self.ok(obj)
示例5: PUT
def PUT(self, repo_id, importer_id, schedule_id):
importer_manager = manager_factory.repo_importer_manager()
schedule_list = importer_manager.list_sync_schedules(repo_id)
if schedule_id not in schedule_list:
raise exceptions.MissingResource(repo=repo_id, importer=importer_id, publish_schedule=schedule_id)
sync_updates = {}
schedule_updates = self.params()
if 'override_config' in schedule_updates:
sync_updates['override_config'] = schedule_updates.pop('override_config')
schedule_manager = manager_factory.schedule_manager()
tags = [resource_tag(dispatch_constants.RESOURCE_REPOSITORY_TYPE, repo_id),
resource_tag(dispatch_constants.RESOURCE_REPOSITORY_IMPORTER_TYPE, importer_id),
resource_tag(dispatch_constants.RESOURCE_SCHEDULE_TYPE, schedule_id),
action_tag('update_sync_schedule')]
call_request = CallRequest(schedule_manager.update_sync_schedule,
[repo_id, importer_id, schedule_id, sync_updates, schedule_updates],
tags=tags,
archive=True)
call_request.reads_resource(dispatch_constants.RESOURCE_REPOSITORY_TYPE, repo_id)
call_request.reads_resource(dispatch_constants.RESOURCE_REPOSITORY_IMPORTER_TYPE, importer_id)
call_request.updates_resource(dispatch_constants.RESOURCE_SCHEDULE_TYPE, schedule_id)
execution.execute(call_request)
scheduler = dispatch_factory.scheduler()
schedule = scheduler.get(schedule_id)
obj = serialization.dispatch.scheduled_sync_obj(schedule)
obj.update(serialization.link.current_link_obj())
return self.ok(obj)
示例6: DELETE
def DELETE(self, repo_id, distributor_id, schedule_id):
distributor_manager = manager_factory.repo_distributor_manager()
schedule_list = distributor_manager.list_publish_schedules(repo_id, distributor_id)
if schedule_id not in schedule_list:
raise exceptions.MissingResource(repo=repo_id, distributor=distributor_id, publish_schedule=schedule_id)
schedule_manager = manager_factory.schedule_manager()
resources = {
dispatch_constants.RESOURCE_REPOSITORY_TYPE: {repo_id: dispatch_constants.RESOURCE_READ_OPERATION},
dispatch_constants.RESOURCE_REPOSITORY_DISTRIBUTOR_TYPE: {
distributor_id: dispatch_constants.RESOURCE_UPDATE_OPERATION
},
dispatch_constants.RESOURCE_SCHEDULE_TYPE: {schedule_id: dispatch_constants.RESOURCE_DELETE_OPERATION},
}
tags = [
resource_tag(dispatch_constants.RESOURCE_REPOSITORY_TYPE, repo_id),
resource_tag(dispatch_constants.RESOURCE_REPOSITORY_DISTRIBUTOR_TYPE, distributor_id),
resource_tag(dispatch_constants.RESOURCE_SCHEDULE_TYPE, schedule_id),
action_tag("delete_publish_schedule"),
]
call_request = CallRequest(
schedule_manager.delete_publish_schedule,
[repo_id, distributor_id, schedule_id],
resources=resources,
tags=tags,
archive=True,
)
return execution.execute_ok(self, call_request)
示例7: unregister
def unregister(self, consumer_id):
"""
Unregisters given consumer.
@param consumer_id: identifies the consumer being unregistered
@type consumer_id: str
@raises MissingResource: if the given consumer does not exist
@raises OperationFailed: if any part of the unregister process fails;
the exception will contain information on which sections failed
@raises PulpExecutionException: if error during updating database collection
"""
self.get_consumer(consumer_id)
# Remove associate bind
manager = factory.consumer_bind_manager()
manager.consumer_deleted(consumer_id)
# Remove associated profiles
manager = factory.consumer_profile_manager()
manager.consumer_deleted(consumer_id)
# Notify agent
agent_consumer = factory.consumer_agent_manager()
agent_consumer.unregistered(consumer_id)
# remove from consumer groups
group_manager = factory.consumer_group_manager()
group_manager.remove_consumer_from_groups(consumer_id)
# delete any scheduled unit installs
schedule_manager = factory.schedule_manager()
schedule_manager.delete_all_unit_install_schedules(consumer_id)
schedule_manager.delete_all_unit_update_schedules(consumer_id)
schedule_manager.delete_all_unit_uninstall_schedules(consumer_id)
# Database Updates
try:
Consumer.get_collection().remove({'id' : consumer_id}, safe=True)
except Exception:
_LOG.exception('Error updating database collection while removing '
'consumer [%s]' % consumer_id)
raise PulpExecutionException("database-error"), None, sys.exc_info()[2]
# remove the consumer from any groups it was a member of
group_manager = factory.consumer_group_manager()
group_manager.remove_consumer_from_groups(consumer_id)
factory.consumer_history_manager().record_event(consumer_id, 'consumer_unregistered')
示例8: DELETE
def DELETE(self, consumer_id, schedule_id):
consumer_manager = managers.consumer_manager()
consumer_manager.get_consumer(consumer_id)
schedule_manager = managers.schedule_manager()
tags = [resource_tag(dispatch_constants.RESOURCE_CONSUMER_TYPE, consumer_id),
resource_tag(dispatch_constants.RESOURCE_SCHEDULE_TYPE, schedule_id),
action_tag('delete_unit_update_schedule')]
call_request = CallRequest(schedule_manager.delete_unit_update_schedule,
[consumer_id, schedule_id],
tags=tags,
archive=True)
call_request.reads_resource(dispatch_constants.RESOURCE_CONSUMER_TYPE, consumer_id)
call_request.deletes_resource(dispatch_constants.RESOURCE_SCHEDULE_TYPE, schedule_id)
result = execution.execute(call_request)
return self.ok(result)
示例9: DELETE
def DELETE(self, repo_id, importer_id, schedule_id):
importer_manager = manager_factory.repo_importer_manager()
schedule_list = importer_manager.list_sync_schedules(repo_id)
if schedule_id not in schedule_list:
raise exceptions.MissingResource(repo=repo_id, importer=importer_id, publish_schedule=schedule_id)
schedule_manager = manager_factory.schedule_manager()
resources = {dispatch_constants.RESOURCE_REPOSITORY_TYPE: {repo_id: dispatch_constants.RESOURCE_READ_OPERATION},
dispatch_constants.RESOURCE_REPOSITORY_IMPORTER_TYPE: {importer_id: dispatch_constants.RESOURCE_UPDATE_OPERATION},
dispatch_constants.RESOURCE_SCHEDULE_TYPE: {schedule_id: dispatch_constants.RESOURCE_DELETE_OPERATION}}
tags = [resource_tag(dispatch_constants.RESOURCE_REPOSITORY_TYPE, repo_id),
resource_tag(dispatch_constants.RESOURCE_REPOSITORY_IMPORTER_TYPE, importer_id),
resource_tag(dispatch_constants.RESOURCE_SCHEDULE_TYPE, schedule_id),
action_tag('delete_sync_schedule')]
call_request = CallRequest(schedule_manager.delete_sync_schedule,
[repo_id, importer_id, schedule_id],
resources=resources,
tags=tags,
archive=True)
return execution.execute_ok(self, call_request)
示例10: DELETE
def DELETE(self, repo_id, distributor_id, schedule_id):
distributor_manager = manager_factory.repo_distributor_manager()
schedule_list = distributor_manager.list_publish_schedules(repo_id, distributor_id)
if schedule_id not in schedule_list:
raise exceptions.MissingResource(repo=repo_id, distributor=distributor_id, publish_schedule=schedule_id)
schedule_manager = manager_factory.schedule_manager()
tags = [resource_tag(dispatch_constants.RESOURCE_REPOSITORY_TYPE, repo_id),
resource_tag(dispatch_constants.RESOURCE_REPOSITORY_DISTRIBUTOR_TYPE, distributor_id),
resource_tag(dispatch_constants.RESOURCE_SCHEDULE_TYPE, schedule_id),
action_tag('delete_publish_schedule')]
call_request = CallRequest(schedule_manager.delete_publish_schedule,
[repo_id, distributor_id, schedule_id],
tags=tags,
archive=True)
call_request.reads_resource(dispatch_constants.RESOURCE_REPOSITORY_TYPE, repo_id)
call_request.updates_resource(dispatch_constants.RESOURCE_REPOSITORY_DISTRIBUTOR_TYPE, distributor_id)
call_request.deletes_resource(dispatch_constants.RESOURCE_SCHEDULE_TYPE, schedule_id)
result = execution.execute(call_request)
return self.ok(result)
示例11: PUT
def PUT(self, repo_id, importer_id, schedule_id):
importer_manager = manager_factory.repo_importer_manager()
schedule_list = importer_manager.list_sync_schedules(repo_id)
if schedule_id not in schedule_list:
raise exceptions.MissingResource(repo=repo_id, importer=importer_id, publish_schedule=schedule_id)
sync_updates = {}
schedule_updates = self.params()
if "override_config" in schedule_updates:
sync_updates["override_config"] = schedule_updates.pop("override_config")
schedule_manager = manager_factory.schedule_manager()
resources = {
dispatch_constants.RESOURCE_REPOSITORY_TYPE: {repo_id: dispatch_constants.RESOURCE_READ_OPERATION},
dispatch_constants.RESOURCE_REPOSITORY_IMPORTER_TYPE: {
importer_id: dispatch_constants.RESOURCE_READ_OPERATION
},
dispatch_constants.RESOURCE_SCHEDULE_TYPE: {schedule_id: dispatch_constants.RESOURCE_UPDATE_OPERATION},
}
tags = [
resource_tag(dispatch_constants.RESOURCE_REPOSITORY_TYPE, repo_id),
resource_tag(dispatch_constants.RESOURCE_REPOSITORY_IMPORTER_TYPE, importer_id),
resource_tag(dispatch_constants.RESOURCE_SCHEDULE_TYPE, schedule_id),
action_tag("update_sync_schedule"),
]
call_request = CallRequest(
schedule_manager.update_sync_schedule,
[repo_id, importer_id, schedule_id, sync_updates, schedule_updates],
resources=resources,
tags=tags,
archive=True,
)
execution.execute(call_request)
scheduler = dispatch_factory.scheduler()
schedule = scheduler.get(schedule_id)
obj = serialization.dispatch.scheduled_sync_obj(schedule)
obj.update(serialization.link.current_link_obj())
return self.ok(obj)