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