本文整理汇总了Python中pulp.server.webservices.execution.execute函数的典型用法代码示例。如果您正苦于以下问题:Python execute函数的具体用法?Python execute怎么用?Python execute使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了execute函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: 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)
示例2: DELETE
def DELETE(self, repo_group_id, distributor_id):
params = self.params()
force = params.get('force', False)
distributor_manager = managers_factory.repo_group_distributor_manager()
resources = {
dispatch_constants.RESOURCE_REPOSITORY_GROUP_TYPE :
{repo_group_id : dispatch_constants.RESOURCE_UPDATE_OPERATION},
dispatch_constants.RESOURCE_REPOSITORY_GROUP_DISTRIBUTOR_TYPE :
{distributor_id : dispatch_constants.RESOURCE_DELETE_OPERATION},
}
tags = [resource_tag(dispatch_constants.RESOURCE_REPOSITORY_GROUP_TYPE, repo_group_id),
resource_tag(dispatch_constants.RESOURCE_REPOSITORY_GROUP_DISTRIBUTOR_TYPE, distributor_id),
action_tag('remove_distributor')
]
call_request = CallRequest(distributor_manager.remove_distributor,
args=[repo_group_id, distributor_id],
kwargs={'force' : force},
resources=resources,
tags=tags,
archive=True)
execution.execute(call_request)
return self.ok(None)
示例3: 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)
示例4: 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)
示例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_associate')]
call_request = CallRequest(manager.associate,
[consumer_group_id, criteria],
tags=tags)
call_request.updates_resource(dispatch_constants.RESOURCE_CONSUMER_GROUP_TYPE, consumer_group_id)
execution.execute(call_request)
collection = ConsumerGroup.get_collection()
group = collection.find_one({'id': consumer_group_id})
return self.ok(group['consumer_ids'])
示例6: 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'])
示例7: POST
def POST(self, repo_id):
"""
Import an uploaded unit into the given repository.
:param repo_id: The id of the repository the upload should be imported into
:type repo_id: basestring
:return: A json serialized dictionary with two keys. 'success_flag' indexes a boolean
value that indicates whether the import was successful, and 'summary' will
contain the summary as reported by the Importer.
:rtype: basestring
"""
# Collect user input
params = self.params()
upload_id = params['upload_id']
unit_type_id = params['unit_type_id']
unit_key = params['unit_key']
unit_metadata = params.pop('unit_metadata', None)
# Coordinator configuration
tags = [resource_tag(dispatch_constants.RESOURCE_REPOSITORY_TYPE, repo_id),
action_tag('import_upload')]
upload_manager = manager_factory.content_upload_manager()
call_request = CallRequest(upload_manager.import_uploaded_unit,
[repo_id, unit_type_id, unit_key, unit_metadata, upload_id],
tags=tags, archive=True)
call_request.updates_resource(dispatch_constants.RESOURCE_REPOSITORY_TYPE, repo_id)
report = execution.execute(call_request)
return self.ok(report)
示例8: DELETE
def DELETE(self, consumer_id, repo_id, distributor_id):
"""
Delete a bind association between the specified
consumer and repo-distributor. Designed to be idempotent.
@param consumer_id: A consumer ID.
@type consumer_id: str
@param repo_id: A repo ID.
@type repo_id: str
@param distributor_id: A distributor ID.
@type distributor_id: str
@return: The deleted bind model object:
{consumer_id:<str>, repo_id:<str>, distributor_id:<str>}
Or, None if bind does not exist.
@rtype: dict
"""
manager = managers.consumer_bind_manager()
resources = {
dispatch_constants.RESOURCE_CONSUMER_TYPE: {consumer_id: dispatch_constants.RESOURCE_READ_OPERATION},
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
},
}
args = [consumer_id, repo_id, distributor_id]
tags = [
resource_tag(dispatch_constants.RESOURCE_CONSUMER_TYPE, consumer_id),
resource_tag(dispatch_constants.RESOURCE_REPOSITORY_TYPE, repo_id),
resource_tag(dispatch_constants.RESOURCE_REPOSITORY_DISTRIBUTOR_TYPE, distributor_id),
action_tag("unbind"),
]
call_request = CallRequest(manager.unbind, args=args, resources=resources, tags=tags)
return self.ok(execution.execute(call_request))
示例9: PUT
def PUT(self, repo_id, importer_id):
# Params (validation will occur in the manager)
params = self.params()
importer_config = params.get('importer_config', None)
if importer_config is None:
_LOG.error('Missing configuration updating importer for repository [%s]' % repo_id)
raise exceptions.MissingValue(['importer_config'])
importer_manager = manager_factory.repo_importer_manager()
resources = {dispatch_constants.RESOURCE_REPOSITORY_TYPE: {repo_id: dispatch_constants.RESOURCE_UPDATE_OPERATION},
dispatch_constants.RESOURCE_REPOSITORY_IMPORTER_TYPE: {importer_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),
action_tag('update_importer')]
call_request = CallRequest(importer_manager.update_importer_config,
[repo_id],
{'importer_config': importer_config},
resources=resources,
tags=tags,
archive=True,
kwarg_blacklist=['importer_config'])
result = execution.execute(call_request)
return self.ok(result)
示例10: PUT
def PUT(self, repo_group_id, distributor_id):
params = self.params()
distributor_config = params.get('distributor_config', None)
if distributor_config is None:
raise pulp_exceptions.MissingValue(['distributor_config'])
distributor_manager = managers_factory.repo_group_distributor_manager()
resources = {
dispatch_constants.RESOURCE_REPOSITORY_GROUP_TYPE :
{repo_group_id : dispatch_constants.RESOURCE_UPDATE_OPERATION},
dispatch_constants.RESOURCE_REPOSITORY_GROUP_DISTRIBUTOR_TYPE :
{distributor_id : dispatch_constants.RESOURCE_UPDATE_OPERATION},
}
tags = [resource_tag(dispatch_constants.RESOURCE_REPOSITORY_GROUP_TYPE, repo_group_id),
resource_tag(dispatch_constants.RESOURCE_REPOSITORY_GROUP_DISTRIBUTOR_TYPE, distributor_id),
action_tag('update_distributor')
]
call_request = CallRequest(distributor_manager.update_distributor_config,
args=[repo_group_id, distributor_id, distributor_config],
resources=resources,
tags=tags,
archive=True)
result = execution.execute(call_request)
href = serialization.link.current_link_obj()
result.update(href)
return self.ok(result)
示例11: DELETE
def DELETE(self, consumer_id, content_type):
"""
Delete an association between the specified
consumer and profile. Designed to be idempotent.
@param consumer_id: A consumer ID.
@type consumer_id: str
@param content_type: The content type ID.
@type content_type: str
@return: The deleted model object:
{consumer_id:<str>, content_type:<str>, profile:<dict>}
Or, None if bind does not exist.
@rtype: dict
"""
manager = managers.consumer_profile_manager()
resources = {
dispatch_constants.RESOURCE_CONSUMER_TYPE:
{consumer_id:dispatch_constants.RESOURCE_READ_OPERATION},
}
args = [
consumer_id,
content_type,
]
tags = [
resource_tag(dispatch_constants.RESOURCE_CONSUMER_TYPE, consumer_id),
]
call_request = CallRequest(manager.delete,
args=args,
resources=resources,
tags=tags)
return self.ok(execution.execute(call_request))
示例12: DELETE
def DELETE(self, consumer_group_id):
manager = managers_factory.consumer_group_manager()
tags = [resource_tag(dispatch_constants.RESOURCE_CONSUMER_GROUP_TYPE, consumer_group_id)]
call_request = CallRequest(manager.delete_consumer_group,
[consumer_group_id],
tags=tags)
call_request.deletes_resource(dispatch_constants.RESOURCE_CONSUMER_GROUP_TYPE, consumer_group_id)
result = execution.execute(call_request)
return self.ok(result)
示例13: PUT
def PUT(self, id):
body = self.params()
delta = body.get("delta")
manager = managers.consumer_manager()
resources = {dispatch_constants.RESOURCE_CONSUMER_TYPE: {id: dispatch_constants.RESOURCE_UPDATE_OPERATION}}
tags = [resource_tag(dispatch_constants.RESOURCE_CONSUMER_TYPE, id), action_tag("update")]
call_request = CallRequest(manager.update, [id, delta], resources=resources, tags=tags)
consumer = execution.execute(call_request)
href = serialization.link.current_link_obj()
consumer.update(href)
return self.ok(consumer)
示例14: 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)
matched = execution.execute(call_request)
return self.ok(matched)
示例15: DELETE
def DELETE(self, role_id):
manager = managers.role_manager()
tags = [resource_tag(dispatch_constants.RESOURCE_CONSUMER_TYPE, role_id),
action_tag('delete')]
call_request = CallRequest(manager.delete_role,
[role_id],
tags=tags)
call_request.deletes_resource(dispatch_constants.RESOURCE_ROLE_TYPE, role_id)
return self.ok(execution.execute(call_request))