diff options
author | Toshio Kuratomi <a.badger@gmail.com> | 2016-09-12 12:57:41 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-12 12:57:41 -0700 |
commit | bf2996194716c7d58b9b543603c2d917e3eac060 (patch) | |
tree | 069372ba6f2ea82ac8e67de7ab3b61aedfc657b8 /bin/ansible | |
parent | 9868117d1f8f71d8489dfabc546aec1ed6e73444 (diff) | |
download | ansible-bf2996194716c7d58b9b543603c2d917e3eac060.tar.gz |
Fixes to the controller text model (#17527)
* Fixes to the controller text model
* Change command line args to text type
* Make display replace undecodable bytes with replacement chars. This
is only a problem on pyhton3 where surrogates can enter into the msg
but sys.stdout doesn't know how to handle them.
* Remove a deprecated playbook syntax in unicode.yml
* Fix up run_cmd to change its parameters to byte string at appropriate times.
Diffstat (limited to 'bin/ansible')
-rwxr-xr-x | bin/ansible | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/bin/ansible b/bin/ansible index c7abff0180..bff20f74cb 100755 --- a/bin/ansible +++ b/bin/ansible @@ -91,9 +91,16 @@ if __name__ == '__main__': else: raise - cli = mycli(sys.argv) - cli.parse() - exit_code = cli.run() + try: + args = [to_text(a, errors='surrogate_or_strict') for a in sys.argv] + except UnicodeError: + display.error('Command line args are not in utf-8, unable to continue. Ansible currently only understands utf-8') + display.display(u"The full traceback was:\n\n%s" % to_text(traceback.format_exc())) + exit_code = 6 + else: + cli = mycli(args) + cli.parse() + exit_code = cli.run() except AnsibleOptionsError as e: cli.parser.print_help() |