Fixes 30786 - add server response to the failure

pull/39371/head
Artem Goncharov 7 years ago
parent 3ce81bdd8d
commit 0ac885f1c7

@ -168,6 +168,9 @@ def _create_stack(module, stack, cloud, shade):
else: else:
module.fail_json(msg="Failure in creating stack: {0}".format(stack)) module.fail_json(msg="Failure in creating stack: {0}".format(stack))
except shade.OpenStackCloudException as e: except shade.OpenStackCloudException as e:
if hasattr(e, 'response'):
module.fail_json(msg=str(e), response=e.response.json())
else:
module.fail_json(msg=str(e)) module.fail_json(msg=str(e))
@ -188,6 +191,9 @@ def _update_stack(module, stack, cloud, shade):
module.fail_json(msg="Failure in updating stack: %s" % module.fail_json(msg="Failure in updating stack: %s" %
stack['stack_status_reason']) stack['stack_status_reason'])
except shade.OpenStackCloudException as e: except shade.OpenStackCloudException as e:
if hasattr(e, 'response'):
module.fail_json(msg=str(e), response=e.response.json())
else:
module.fail_json(msg=str(e)) module.fail_json(msg=str(e))

Loading…
Cancel
Save