From 44aeea7afc48eaf4bee5df65a902792d81e45f10 Mon Sep 17 00:00:00 2001 From: Julien Phalip Date: Thu, 26 Sep 2013 17:12:29 -0700 Subject: [PATCH] In the script action: Get around a bug in that's been fixed in Python 2.7 but not Python 2.6. See: http://bugs.python.org/issue6988 Fixes #4256. --- lib/ansible/runner/action_plugins/script.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/ansible/runner/action_plugins/script.py b/lib/ansible/runner/action_plugins/script.py index 17032220245..12845477c22 100644 --- a/lib/ansible/runner/action_plugins/script.py +++ b/lib/ansible/runner/action_plugins/script.py @@ -36,7 +36,11 @@ class ActionModule(object): # in check mode, always skip this module return ReturnData(conn=conn, comm_ok=True, result=dict(skipped=True, msg='check mode not supported for this module')) - tokens = shlex.split(module_args) + # Decode the result of shlex.split() to UTF8 to get around a bug in that's been fixed in Python 2.7 but not Python 2.6. + # See: http://bugs.python.org/issue6988 + tokens = shlex.split(module_args.encode('utf8')) + tokens = [s.decode('utf8') for s in tokens] + source = tokens[0] # FIXME: error handling args = " ".join(tokens[1:])