Fix OpenStack module failure output

The exception message, when shade fails, will contain much more
specific information about the failure if the exception is treated
as a string. The 'message' attribute alone is usually not helpful.
reviewable/pr18780/r1
David Shrewsbury 9 years ago
parent a21ea16d47
commit e8abea25c7

@ -60,7 +60,7 @@ def main():
auth_token=cloud.auth_token,
service_catalog=cloud.service_catalog))
except shade.OpenStackCloudException as e:
module.fail_json(msg=e.message)
module.fail_json(msg=str(e))
# this is magic, see lib/ansible/module_common.py
from ansible.module_utils.basic import *

@ -175,7 +175,7 @@ def main():
module.exit_json(changed=True, floating_ip=f_ip)
except shade.OpenStackCloudException as e:
module.fail_json(msg=e.message, extra_data=e.extra_data)
module.fail_json(msg=str(e), extra_data=e.extra_data)
# this is magic, see lib/ansible/module_common.py

@ -183,7 +183,7 @@ def main():
module.exit_json(changed=changed)
except shade.OpenStackCloudException as e:
module.fail_json(msg=e.message, extra_data=e.extra_data)
module.fail_json(msg=str(e), extra_data=e.extra_data)
# this is magic, see lib/ansible/module_common.py
from ansible.module_utils.basic import *

@ -148,7 +148,7 @@ def main():
openstack_image=image))
except shade.OpenStackCloudException as e:
module.fail_json(msg=e.message)
module.fail_json(msg=str(e))
# this is magic, see lib/ansible/module_common.py
from ansible.module_utils.basic import *

@ -338,7 +338,7 @@ def main():
module.exit_json(changed=False, result="Server not found")
except shade.OpenStackCloudException as e:
module.fail_json(msg=e.message)
module.fail_json(msg=str(e))
# this is magic, see lib/ansible/module_common.py

@ -324,7 +324,7 @@ def main():
"maintenance, off")
except shade.OpenStackCloudException as e:
module.fail_json(msg=e.message)
module.fail_json(msg=str(e))
# this is magic, see lib/ansible/module_common.py

@ -162,7 +162,7 @@ def main():
module.exit_json(changed=False)
except shade.OpenStackCloudException as e:
module.fail_json(msg=e.message)
module.fail_json(msg=str(e))
# this is magic, see lib/ansible/module_common.py
from ansible.module_utils.basic import *

@ -159,7 +159,7 @@ def main():
module.exit_json(changed=True)
except shade.OpenStackCloudException as e:
module.fail_json(msg=e.message)
module.fail_json(msg=str(e))
# this is magic, see lib/ansible/module_common.py

@ -132,7 +132,7 @@ def main():
openstack_networks=networks))
except shade.OpenStackCloudException as e:
module.fail_json(msg=e.message)
module.fail_json(msg=str(e))
# this is magic, see lib/ansible/module_common.py
from ansible.module_utils.basic import *

@ -232,7 +232,7 @@ def main():
module.exit_json(changed=False)
except shade.OpenStackCloudException as e:
module.fail_json(msg=e.message)
module.fail_json(msg=str(e))
# this is magic, see lib/ansible/module_common.py

@ -117,7 +117,7 @@ def main():
module.exit_json(changed=changed)
except shade.OpenStackCloudException as e:
module.fail_json(msg=e.message)
module.fail_json(msg=str(e))
# this is magic, see lib/ansible/module_common.py
from ansible.module_utils.basic import *

@ -383,7 +383,7 @@ def main():
module.exit_json(changed=changed)
except shade.OpenStackCloudException as e:
module.fail_json(msg=e.message)
module.fail_json(msg=str(e))
# this is magic, see lib/ansible/module_common.py
from ansible.module_utils.basic import *

@ -352,7 +352,7 @@ def main():
module.exit_json(changed=True)
except shade.OpenStackCloudException as e:
module.fail_json(msg=e.message)
module.fail_json(msg=str(e))
# this is magic, see lib/ansible/module_common.py

@ -134,7 +134,7 @@ def main():
module.exit_json(changed=changed)
except shade.OpenStackCloudException as e:
module.fail_json(msg=e.message)
module.fail_json(msg=str(e))
# this is magic, see lib/ansible/module_common.py
from ansible.module_utils.basic import *

@ -317,7 +317,7 @@ def main():
module.exit_json(changed=changed)
except shade.OpenStackCloudException as e:
module.fail_json(msg=e.message)
module.fail_json(msg=str(e))
# this is magic, see lib/ansible/module_common.py
from ansible.module_utils.basic import *

@ -606,7 +606,7 @@ def main():
_get_server_state(module, cloud)
_delete_server(module, cloud)
except shade.OpenStackCloudException as e:
module.fail_json(msg=e.message, extra_data=e.extra_data)
module.fail_json(msg=str(e), extra_data=e.extra_data)
# this is magic, see lib/ansible/module_common.py
from ansible.module_utils.basic import *

@ -204,7 +204,7 @@ def main():
module.exit_json(changed=True)
except shade.OpenStackCloudException as e:
module.fail_json(msg=e.message, extra_data=e.extra_data)
module.fail_json(msg=str(e), extra_data=e.extra_data)
# this is magic, see lib/ansible/module_common.py
from ansible.module_utils.basic import *

@ -89,7 +89,7 @@ def main():
openstack_servers=openstack_servers))
except shade.OpenStackCloudException as e:
module.fail_json(msg=e.message)
module.fail_json(msg=str(e))
# this is magic, see lib/ansible/module_common.py
from ansible.module_utils.basic import *

@ -146,7 +146,7 @@ def main():
)
except (shade.OpenStackCloudException, shade.OpenStackCloudTimeout) as e:
module.fail_json(msg=e.message)
module.fail_json(msg=str(e))
# this is magic, see lib/ansible/module_utils/common.py
from ansible.module_utils.basic import *

@ -315,7 +315,7 @@ def main():
module.exit_json(changed=changed)
except shade.OpenStackCloudException as e:
module.fail_json(msg=e.message)
module.fail_json(msg=str(e))
# this is magic, see lib/ansible/module_common.py

@ -145,7 +145,7 @@ def main():
openstack_subnets=subnets))
except shade.OpenStackCloudException as e:
module.fail_json(msg=e.message)
module.fail_json(msg=str(e))
# this is magic, see lib/ansible/module_common.py
from ansible.module_utils.basic import *

@ -202,7 +202,7 @@ def main():
module.exit_json(changed=changed)
except shade.OpenStackCloudException as e:
module.fail_json(msg=e.message, extra_data=e.extra_data)
module.fail_json(msg=str(e), extra_data=e.extra_data)
from ansible.module_utils.basic import *
from ansible.module_utils.openstack import *

@ -106,7 +106,7 @@ def main():
module.exit_json(changed=changed)
except shade.OpenStackCloudException as e:
module.fail_json(msg=e.message, extra_data=e.extra_data)
module.fail_json(msg=str(e), extra_data=e.extra_data)
from ansible.module_utils.basic import *

@ -153,7 +153,7 @@ def main():
if state == 'absent':
_absent_volume(module, cloud)
except shade.OpenStackCloudException as e:
module.fail_json(msg=e.message)
module.fail_json(msg=str(e))
# this is magic, see lib/ansible/module_common.py
from ansible.module_utils.basic import *

Loading…
Cancel
Save