summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Shrewsbury <shrewsbury.dave@gmail.com>2016-01-13 11:00:16 -0500
committerDavid Shrewsbury <shrewsbury.dave@gmail.com>2016-01-13 11:15:24 -0500
commite8abea25c74456e6a6f142fdeee09ee2b492b6f7 (patch)
treea7b5d00dc0c2eec69fadc8b5807fd1bf5552531b
parenta21ea16d47b302175cdf4041805a3071ffc6dd63 (diff)
downloadansible-modules-core-e8abea25c74456e6a6f142fdeee09ee2b492b6f7.tar.gz
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.
-rw-r--r--cloud/openstack/os_auth.py2
-rw-r--r--cloud/openstack/os_floating_ip.py2
-rw-r--r--cloud/openstack/os_image.py2
-rw-r--r--cloud/openstack/os_image_facts.py2
-rw-r--r--cloud/openstack/os_ironic.py2
-rw-r--r--cloud/openstack/os_ironic_node.py2
-rw-r--r--cloud/openstack/os_keypair.py2
-rw-r--r--cloud/openstack/os_network.py2
-rw-r--r--cloud/openstack/os_networks_facts.py2
-rw-r--r--cloud/openstack/os_nova_flavor.py2
-rw-r--r--cloud/openstack/os_object.py2
-rw-r--r--cloud/openstack/os_port.py2
-rw-r--r--cloud/openstack/os_router.py2
-rw-r--r--cloud/openstack/os_security_group.py2
-rw-r--r--cloud/openstack/os_security_group_rule.py2
-rw-r--r--cloud/openstack/os_server.py2
-rw-r--r--cloud/openstack/os_server_actions.py2
-rw-r--r--cloud/openstack/os_server_facts.py2
-rw-r--r--cloud/openstack/os_server_volume.py2
-rw-r--r--cloud/openstack/os_subnet.py2
-rw-r--r--cloud/openstack/os_subnets_facts.py2
-rw-r--r--cloud/openstack/os_user.py2
-rw-r--r--cloud/openstack/os_user_group.py2
-rw-r--r--cloud/openstack/os_volume.py2
24 files changed, 24 insertions, 24 deletions
diff --git a/cloud/openstack/os_auth.py b/cloud/openstack/os_auth.py
index a881c217..4f4d22ea 100644
--- a/cloud/openstack/os_auth.py
+++ b/cloud/openstack/os_auth.py
@@ -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 *
diff --git a/cloud/openstack/os_floating_ip.py b/cloud/openstack/os_floating_ip.py
index b6342f8f..5d3ca7ef 100644
--- a/cloud/openstack/os_floating_ip.py
+++ b/cloud/openstack/os_floating_ip.py
@@ -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
diff --git a/cloud/openstack/os_image.py b/cloud/openstack/os_image.py
index b83e9885..565bd868 100644
--- a/cloud/openstack/os_image.py
+++ b/cloud/openstack/os_image.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 *
diff --git a/cloud/openstack/os_image_facts.py b/cloud/openstack/os_image_facts.py
index a5453717..fd3b4f3f 100644
--- a/cloud/openstack/os_image_facts.py
+++ b/cloud/openstack/os_image_facts.py
@@ -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 *
diff --git a/cloud/openstack/os_ironic.py b/cloud/openstack/os_ironic.py
index a6612cf1..d1074caa 100644
--- a/cloud/openstack/os_ironic.py
+++ b/cloud/openstack/os_ironic.py
@@ -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
diff --git a/cloud/openstack/os_ironic_node.py b/cloud/openstack/os_ironic_node.py
index f087581c..8a18fce0 100644
--- a/cloud/openstack/os_ironic_node.py
+++ b/cloud/openstack/os_ironic_node.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
diff --git a/cloud/openstack/os_keypair.py b/cloud/openstack/os_keypair.py
index 64ebd8c6..cf2b0a80 100644
--- a/cloud/openstack/os_keypair.py
+++ b/cloud/openstack/os_keypair.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 *
diff --git a/cloud/openstack/os_network.py b/cloud/openstack/os_network.py
index 82863ebd..98ea4495 100644
--- a/cloud/openstack/os_network.py
+++ b/cloud/openstack/os_network.py
@@ -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
diff --git a/cloud/openstack/os_networks_facts.py b/cloud/openstack/os_networks_facts.py
index 6ac87864..8b7592be 100644
--- a/cloud/openstack/os_networks_facts.py
+++ b/cloud/openstack/os_networks_facts.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 *
diff --git a/cloud/openstack/os_nova_flavor.py b/cloud/openstack/os_nova_flavor.py
index f7924030..102b2bf2 100644
--- a/cloud/openstack/os_nova_flavor.py
+++ b/cloud/openstack/os_nova_flavor.py
@@ -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
diff --git a/cloud/openstack/os_object.py b/cloud/openstack/os_object.py
index 22fcebb7..1375cc5a 100644
--- a/cloud/openstack/os_object.py
+++ b/cloud/openstack/os_object.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 *
diff --git a/cloud/openstack/os_port.py b/cloud/openstack/os_port.py
index d218e938..67bcac7b 100644
--- a/cloud/openstack/os_port.py
+++ b/cloud/openstack/os_port.py
@@ -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 *
diff --git a/cloud/openstack/os_router.py b/cloud/openstack/os_router.py
index d48ed041..f0df8b14 100644
--- a/cloud/openstack/os_router.py
+++ b/cloud/openstack/os_router.py
@@ -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
diff --git a/cloud/openstack/os_security_group.py b/cloud/openstack/os_security_group.py
index fd839755..63311b53 100644
--- a/cloud/openstack/os_security_group.py
+++ b/cloud/openstack/os_security_group.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 *
diff --git a/cloud/openstack/os_security_group_rule.py b/cloud/openstack/os_security_group_rule.py
index b2324b09..ef63bfac 100644
--- a/cloud/openstack/os_security_group_rule.py
+++ b/cloud/openstack/os_security_group_rule.py
@@ -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 *
diff --git a/cloud/openstack/os_server.py b/cloud/openstack/os_server.py
index 036d4edd..c626d503 100644
--- a/cloud/openstack/os_server.py
+++ b/cloud/openstack/os_server.py
@@ -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 *
diff --git a/cloud/openstack/os_server_actions.py b/cloud/openstack/os_server_actions.py
index 76f34c47..44ff6afc 100644
--- a/cloud/openstack/os_server_actions.py
+++ b/cloud/openstack/os_server_actions.py
@@ -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 *
diff --git a/cloud/openstack/os_server_facts.py b/cloud/openstack/os_server_facts.py
index bd694dbc..bcda1d4f 100644
--- a/cloud/openstack/os_server_facts.py
+++ b/cloud/openstack/os_server_facts.py
@@ -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 *
diff --git a/cloud/openstack/os_server_volume.py b/cloud/openstack/os_server_volume.py
index 945a0ce8..e71e0954 100644
--- a/cloud/openstack/os_server_volume.py
+++ b/cloud/openstack/os_server_volume.py
@@ -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 *
diff --git a/cloud/openstack/os_subnet.py b/cloud/openstack/os_subnet.py
index 1913d95c..19354ccf 100644
--- a/cloud/openstack/os_subnet.py
+++ b/cloud/openstack/os_subnet.py
@@ -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
diff --git a/cloud/openstack/os_subnets_facts.py b/cloud/openstack/os_subnets_facts.py
index 0f11fc6b..676daefe 100644
--- a/cloud/openstack/os_subnets_facts.py
+++ b/cloud/openstack/os_subnets_facts.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 *
diff --git a/cloud/openstack/os_user.py b/cloud/openstack/os_user.py
index f5baa6fc..a3c2cb4e 100644
--- a/cloud/openstack/os_user.py
+++ b/cloud/openstack/os_user.py
@@ -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 *
diff --git a/cloud/openstack/os_user_group.py b/cloud/openstack/os_user_group.py
index b2be24c7..9d21a7f0 100644
--- a/cloud/openstack/os_user_group.py
+++ b/cloud/openstack/os_user_group.py
@@ -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 *
diff --git a/cloud/openstack/os_volume.py b/cloud/openstack/os_volume.py
index 80ad2adc..5a3d0aac 100644
--- a/cloud/openstack/os_volume.py
+++ b/cloud/openstack/os_volume.py
@@ -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 *