Merge "Fix GET /executions/<id> to init 'output' attribute explicitly"

This commit is contained in:
Jenkins
2016-08-08 05:10:23 +00:00
committed by Gerrit Code Review
2 changed files with 19 additions and 4 deletions

View File

@@ -109,6 +109,7 @@ class ActionExecutionsController(rest.RestController):
def get(self, id):
"""Return the specified action_execution."""
acl.enforce('action_executions:get', context.ctx())
LOG.info("Fetch action_execution [id=%s]" % id)
return _get_action_execution(id)
@@ -119,6 +120,7 @@ class ActionExecutionsController(rest.RestController):
def post(self, action_ex):
"""Create new action_execution."""
acl.enforce('action_executions:create', context.ctx())
LOG.info("Create action_execution [action_execution=%s]" % action_ex)
name = action_ex.name
@@ -149,6 +151,7 @@ class ActionExecutionsController(rest.RestController):
def put(self, id, action_ex):
"""Update the specified action_execution."""
acl.enforce('action_executions:update', context.ctx())
LOG.info(
"Update action_execution [id=%s, action_execution=%s]"
% (id, action_ex)
@@ -272,8 +275,8 @@ class ActionExecutionsController(rest.RestController):
@wsme_pecan.wsexpose(None, wtypes.text, status_code=204)
def delete(self, id):
"""Delete the specified action_execution."""
acl.enforce('action_executions:delete', context.ctx())
LOG.info("Delete action_execution [id=%s]" % id)
if not cfg.CONF.api.allow_action_execution_deletion:
@@ -352,6 +355,7 @@ class TasksActionExecutionController(rest.RestController):
update time and date.
"""
acl.enforce('action_executions:list', context.ctx())
if tag is not None:
if tags is None:
tags = [tag]
@@ -393,6 +397,7 @@ class TasksActionExecutionController(rest.RestController):
def get(self, task_execution_id, action_ex_id):
"""Return the specified action_execution."""
acl.enforce('action_executions:get', context.ctx())
LOG.info("Fetch action_execution [id=%s]" % action_ex_id)
return _get_action_execution(action_ex_id)

View File

@@ -57,11 +57,18 @@ class ExecutionsController(rest.RestController):
def get(self, id):
"""Return the specified Execution."""
acl.enforce("executions:get", context.ctx())
LOG.info("Fetch execution [id=%s]" % id)
return resources.Execution.from_dict(
db_api.get_workflow_execution(id).to_dict()
)
with db_api.transaction():
wf_ex = db_api.get_workflow_execution(id)
# If a single object is requested we need to explicitly load
# 'output' attribute. We don't do this for collections to reduce
# amount of DB queries and network traffic.
hasattr(wf_ex, 'output')
return resources.Execution.from_dict(wf_ex.to_dict())
@rest_utils.wrap_wsme_controller_exception
@wsme_pecan.wsexpose(
@@ -76,6 +83,7 @@ class ExecutionsController(rest.RestController):
:param wf_ex: Execution object.
"""
acl.enforce('executions:update', context.ctx())
LOG.info('Update execution [id=%s, execution=%s]' % (id, wf_ex))
db_api.ensure_workflow_execution_exists(id)
@@ -173,6 +181,7 @@ class ExecutionsController(rest.RestController):
:param wf_ex: Execution object with input content.
"""
acl.enforce('executions:create', context.ctx())
LOG.info('Create execution [execution=%s]' % wf_ex)
engine = rpc.get_engine_client()
@@ -199,6 +208,7 @@ class ExecutionsController(rest.RestController):
def delete(self, id):
"""Delete the specified Execution."""
acl.enforce('executions:delete', context.ctx())
LOG.info('Delete execution [id=%s]' % id)
return db_api.delete_workflow_execution(id)