Fixes 30786 - add server response to the failure

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

@ -168,7 +168,10 @@ 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:
module.fail_json(msg=str(e)) if hasattr(e, 'response'):
module.fail_json(msg=str(e), response=e.response.json())
else:
module.fail_json(msg=str(e))
def _update_stack(module, stack, cloud, shade): def _update_stack(module, stack, cloud, shade):
@ -188,7 +191,10 @@ 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:
module.fail_json(msg=str(e)) if hasattr(e, 'response'):
module.fail_json(msg=str(e), response=e.response.json())
else:
module.fail_json(msg=str(e))
def _system_state_change(module, stack, cloud): def _system_state_change(module, stack, cloud):

Loading…
Cancel
Save