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.
This commit is contained in:
David Shrewsbury 2016-01-13 11:00:16 -05:00
parent a21ea16d47
commit e8abea25c7
24 changed files with 24 additions and 24 deletions

View file

@ -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 *

View file

@ -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

View file

@ -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 *

View file

@ -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 *

View file

@ -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

View file

@ -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

View file

@ -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 *

View file

@ -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

View file

@ -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 *

View file

@ -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

View file

@ -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 *

View file

@ -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 *

View file

@ -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

View file

@ -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 *

View file

@ -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 *

View file

@ -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 *

View file

@ -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 *

View file

@ -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 *

View file

@ -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 *

View file

@ -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

View file

@ -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 *

View file

@ -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 *

View file

@ -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 *

View file

@ -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 *