removing unwanted variables and using to_native instead of str()

This commit is contained in:
jerry 2016-11-21 20:28:51 +00:00 committed by Brian Coca
parent ef1ecfd2c2
commit c4b09cbcb4

View file

@ -2268,11 +2268,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.log("Error Executing CMD:%s Exception:%s" % (clean_args, to_native(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.log("Error Executing CMD:%s Exception:%s" % (clean_args,to_native(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