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
This commit is contained in:
parent
38892e986e
commit
60f972dfe4
1 changed files with 7 additions and 2 deletions
|
@ -1433,7 +1433,7 @@ class AnsibleModule(object):
|
|||
msg = 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
|
||||
if path_prefix:
|
||||
env['PATH']="%s:%s" % (path_prefix, env['PATH'])
|
||||
|
@ -1442,7 +1442,12 @@ class AnsibleModule(object):
|
|||
# in reporting later, which strips out things like
|
||||
# passwords from the args list
|
||||
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:
|
||||
to_clean_args = args
|
||||
|
||||
|
|
Loading…
Reference in a new issue