Commit 60f972df by Toshio Kuratomi

Fix the command module handling of non-ascii values.

We can't depend on the args being unicode text because we're in module
land, not in the ansible controller land
parent 38892e98
...@@ -1433,7 +1433,7 @@ class AnsibleModule(object): ...@@ -1433,7 +1433,7 @@ class AnsibleModule(object):
msg = None msg = None
st_in = None st_in = None
# Set a temporart env path if a prefix is passed # Set a temporary env path if a prefix is passed
env=os.environ env=os.environ
if path_prefix: if path_prefix:
env['PATH']="%s:%s" % (path_prefix, env['PATH']) env['PATH']="%s:%s" % (path_prefix, env['PATH'])
...@@ -1442,7 +1442,12 @@ class AnsibleModule(object): ...@@ -1442,7 +1442,12 @@ class AnsibleModule(object):
# in reporting later, which strips out things like # in reporting later, which strips out things like
# passwords from the args list # passwords from the args list
if isinstance(args, basestring): if isinstance(args, basestring):
to_clean_args = shlex.split(args.encode('utf-8')) if isinstance(args, unicode):
b_args = args.encode('utf-8')
else:
b_args = args
to_clean_args = shlex.split(b_args)
del b_args
else: else:
to_clean_args = args to_clean_args = args
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment