Return exception as string
Pyodbc returns exception as Python Exception class, typecast as string for fail_json. Partially fixes: #25010 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
parent
da6f6d27e8
commit
077a2df1d6
5 changed files with 10 additions and 5 deletions
|
@ -89,6 +89,7 @@ else:
|
|||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.pycompat24 import get_exception
|
||||
from ansible.module_utils._text import to_native
|
||||
|
||||
|
||||
class NotSupportedError(Exception):
|
||||
|
@ -198,7 +199,7 @@ def main():
|
|||
raise
|
||||
except Exception:
|
||||
e = get_exception()
|
||||
module.fail_json(msg=e)
|
||||
module.fail_json(msg=to_native(e))
|
||||
|
||||
module.exit_json(changed=changed, parameter=parameter_name, ansible_facts={'vertica_configuration': configuration_facts})
|
||||
|
||||
|
|
|
@ -81,6 +81,7 @@ else:
|
|||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.pycompat24 import get_exception
|
||||
from ansible.module_utils._text import to_native
|
||||
|
||||
|
||||
class NotSupportedError(Exception):
|
||||
|
@ -278,7 +279,7 @@ def main():
|
|||
raise
|
||||
except Exception:
|
||||
e = get_exception()
|
||||
module.fail_json(msg=e)
|
||||
module.fail_json(msg=to_native(e))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
@ -100,6 +100,7 @@ else:
|
|||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.pycompat24 import get_exception
|
||||
from ansible.module_utils._text import to_native
|
||||
|
||||
|
||||
class NotSupportedError(Exception):
|
||||
|
@ -248,7 +249,7 @@ def main():
|
|||
raise
|
||||
except Exception:
|
||||
e = get_exception()
|
||||
module.fail_json(msg=e)
|
||||
module.fail_json(msg=to_native(e))
|
||||
|
||||
module.exit_json(changed=changed, role=role, ansible_facts={'vertica_roles': role_facts})
|
||||
|
||||
|
|
|
@ -124,6 +124,7 @@ else:
|
|||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.pycompat24 import get_exception
|
||||
from ansible.module_utils._text import to_native
|
||||
|
||||
|
||||
class NotSupportedError(Exception):
|
||||
|
@ -323,7 +324,7 @@ def main():
|
|||
raise
|
||||
except Exception:
|
||||
e = get_exception()
|
||||
module.fail_json(msg=e)
|
||||
module.fail_json(msg=to_native(e))
|
||||
|
||||
module.exit_json(changed=changed, schema=schema, ansible_facts={'vertica_schemas': schema_facts})
|
||||
|
||||
|
|
|
@ -137,6 +137,7 @@ else:
|
|||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.pycompat24 import get_exception
|
||||
from ansible.module_utils._text import to_native
|
||||
|
||||
|
||||
class NotSupportedError(Exception):
|
||||
|
@ -393,7 +394,7 @@ def main():
|
|||
raise
|
||||
except Exception:
|
||||
e = get_exception()
|
||||
module.fail_json(msg=e)
|
||||
module.fail_json(msg=to_native(e))
|
||||
|
||||
module.exit_json(changed=changed, user=user, ansible_facts={'vertica_users': user_facts})
|
||||
|
||||
|
|
Loading…
Reference in a new issue