Fix bugs in ReST API stack creation
Change-Id: I39277224305465cc951e397f340012563c0f7174 Signed-off-by: Zane Bitter <zbitter@redhat.com>
This commit is contained in:
parent
3e603825a8
commit
9cf1c6f269
@ -56,7 +56,7 @@ CREATE_PARAMS = (
|
||||
)
|
||||
|
||||
|
||||
def json_parse(self, data, data_type):
|
||||
def json_parse(data, data_type):
|
||||
try:
|
||||
return json.loads(data)
|
||||
except ValueError:
|
||||
@ -211,22 +211,25 @@ class StackController(object):
|
||||
"""
|
||||
if PARAM_STACK_NAME not in req.params:
|
||||
raise exc.HTTPBadRequest(explanation=_("No stack name specified"))
|
||||
stack_name = req.params[PARAMS_STACK_NAME]
|
||||
stack_name = req.params[PARAM_STACK_NAME]
|
||||
|
||||
stack_params = get_user_params(req)
|
||||
template = get_template(req)
|
||||
args = get_args(req)
|
||||
|
||||
try:
|
||||
identity = self.engine_rpcapi.create_stack(req.context,
|
||||
stack_name,
|
||||
template,
|
||||
stack_params,
|
||||
args)
|
||||
result = self.engine_rpcapi.create_stack(req.context,
|
||||
stack_name,
|
||||
template,
|
||||
stack_params,
|
||||
args)
|
||||
except rpc_common.RemoteError as ex:
|
||||
return self._remote_error(ex)
|
||||
|
||||
raise exc.HTTPCreated(location=stack_url(req, identity))
|
||||
if 'Description' in result:
|
||||
raise exc.HTTPBadRequest(explanation=result['Description'])
|
||||
|
||||
raise exc.HTTPCreated(location=stack_url(req, result))
|
||||
|
||||
@tenant_local
|
||||
def lookup(self, req, stack_name):
|
||||
@ -296,6 +299,9 @@ class StackController(object):
|
||||
except rpc_common.RemoteError as ex:
|
||||
return self._remote_error(ex)
|
||||
|
||||
if 'Description' in res:
|
||||
raise exc.HTTPBadRequest(explanation=res['Description'])
|
||||
|
||||
raise exc.HTTPAccepted()
|
||||
|
||||
@identified_stack
|
||||
|
Loading…
Reference in New Issue
Block a user