summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorJames Cammarata <jimi@sngx.net>2015-10-08 10:04:15 -0400
committerJames Cammarata <jimi@sngx.net>2015-10-08 10:04:15 -0400
commitde792ba3c2e76fb537069f2ea0174645a7d19a89 (patch)
tree6bfcaac557b75222bc6920d7e3098a23a09788fa /bin
parent5a0f5f1254f8a94194d389d1993f5a0e41a44255 (diff)
downloadansible-de792ba3c2e76fb537069f2ea0174645a7d19a89.tar.gz
Improve handling of unicode errors
Fixes #12669
Diffstat (limited to 'bin')
-rwxr-xr-xbin/ansible9
1 files changed, 5 insertions, 4 deletions
diff --git a/bin/ansible b/bin/ansible
index 209b235c88..a117856d89 100755
--- a/bin/ansible
+++ b/bin/ansible
@@ -38,6 +38,7 @@ import traceback
from ansible.errors import AnsibleError, AnsibleOptionsError, AnsibleParserError
from ansible.utils.display import Display
+from ansible.utils.unicode import to_unicode
########################################
### OUTPUT OF LAST RESORT ###
@@ -82,10 +83,10 @@ if __name__ == '__main__':
except AnsibleOptionsError as e:
cli.parser.print_help()
- display.error(str(e), wrap_text=False)
+ display.error(to_unicode(e), wrap_text=False)
sys.exit(5)
except AnsibleParserError as e:
- display.error(str(e), wrap_text=False)
+ display.error(to_unicode(e), wrap_text=False)
sys.exit(4)
# TQM takes care of these, but leaving comment to reserve the exit codes
# except AnsibleHostUnreachable as e:
@@ -95,14 +96,14 @@ if __name__ == '__main__':
# display.error(str(e))
# sys.exit(2)
except AnsibleError as e:
- display.error(str(e), wrap_text=False)
+ display.error(to_unicode(e), wrap_text=False)
sys.exit(1)
except KeyboardInterrupt:
display.error("User interrupted execution")
sys.exit(99)
except Exception as e:
have_cli_options = cli is not None and cli.options is not None
- display.error("Unexpected Exception: %s" % str(e), wrap_text=False)
+ display.error("Unexpected Exception: %s" % to_unicode(e), wrap_text=False)
if not have_cli_options or have_cli_options and cli.options.verbosity > 2:
display.display("the full traceback was:\n\n%s" % traceback.format_exc())
else: