We now have an exception return value. Make use of it instead of putting the traceback into msg (#17365)
This commit is contained in:
parent
6d0755f71e
commit
67177105e3
1 changed files with 4 additions and 3 deletions
|
@ -2237,9 +2237,10 @@ class AnsibleModule(object):
|
||||||
rc = cmd.returncode
|
rc = cmd.returncode
|
||||||
except (OSError, IOError):
|
except (OSError, IOError):
|
||||||
e = get_exception()
|
e = get_exception()
|
||||||
self.fail_json(rc=e.errno, msg=str(e), cmd=clean_args)
|
self.fail_json(rc=e.errno, msg=to_native(e), cmd=clean_args)
|
||||||
except:
|
except Exception:
|
||||||
self.fail_json(rc=257, msg=traceback.format_exc(), cmd=clean_args)
|
e = get_exception()
|
||||||
|
self.fail_json(rc=257, msg=to_native(e), exception=traceback.format_exc(), cmd=clean_args)
|
||||||
|
|
||||||
# Restore env settings
|
# Restore env settings
|
||||||
for key, val in old_env_vals.items():
|
for key, val in old_env_vals.items():
|
||||||
|
|
Loading…
Reference in a new issue