Adding self.log() on IOErrors and OSErrros

This commit is contained in:
jeronimog 2016-10-07 10:17:54 +01:00 committed by Brian Coca
parent 39acdde5aa
commit ef1ecfd2c2

View file

@ -2268,9 +2268,11 @@ class AnsibleModule(object):
rc = cmd.returncode
except (OSError, IOError):
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)
except 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)
# Restore env settings