summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToshio Kuratomi <toshio@fedoraproject.org>2015-03-25 13:57:48 -0700
committerToshio Kuratomi <toshio@fedoraproject.org>2015-03-25 13:57:48 -0700
commit60f972dfe4bc58180c666f820ef2d602acf917e4 (patch)
tree236ae585d15725fd1668e867aeffbb0d743bc787
parent38892e986ef78271a06b1d228a0d3294281c40d4 (diff)
downloadansible-60f972dfe4bc58180c666f820ef2d602acf917e4.tar.gz
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
-rw-r--r--v2/ansible/module_utils/basic.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/v2/ansible/module_utils/basic.py b/v2/ansible/module_utils/basic.py
index 79a0fab67b..b3cebf0ba5 100644
--- a/v2/ansible/module_utils/basic.py
+++ b/v2/ansible/module_utils/basic.py
@@ -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