mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Adding self.log() on IOErrors and OSErrros
(cherry picked from commit ef1ecfd2c28412531fc7e0482b66dab92226306f)
This commit is contained in:
parent
300718e811
commit
4f85e4831d
1 changed files with 2 additions and 0 deletions
|
@ -2441,9 +2441,11 @@ class AnsibleModule(object):
|
||||||
rc = cmd.returncode
|
rc = cmd.returncode
|
||||||
except (OSError, IOError):
|
except (OSError, IOError):
|
||||||
e = get_exception()
|
e = get_exception()
|
||||||
|
self.log("%s: Error Executing CMD:%s PERM:%s Exception:%s" % (args[0] , args[1] , str(e)))
|
||||||
self.fail_json(rc=e.errno, msg=to_native(e), cmd=clean_args)
|
self.fail_json(rc=e.errno, msg=to_native(e), cmd=clean_args)
|
||||||
except Exception:
|
except Exception:
|
||||||
e = get_exception()
|
e = get_exception()
|
||||||
|
self.log("%s: Error Executing CMD:%s PERM:%s Exception:%s" % (args[0] , args[1] , str(traceback.format_exc())))
|
||||||
self.fail_json(rc=257, msg=to_native(e), exception=traceback.format_exc(), cmd=clean_args)
|
self.fail_json(rc=257, msg=to_native(e), exception=traceback.format_exc(), cmd=clean_args)
|
||||||
|
|
||||||
# Restore env settings
|
# Restore env settings
|
||||||
|
|
Loading…
Reference in a new issue