From 92ad206b84dff9f02d1c855232d1489ced9cbdf3 Mon Sep 17 00:00:00 2001 From: Daniel Hokka Zakrisson Date: Wed, 9 Jan 2013 14:13:53 +0100 Subject: [PATCH] Use re instead of shlex.split to find executable shlex.split will strip quotes and it might not even be sh at this point. --- lib/ansible/runner/action_plugins/raw.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/ansible/runner/action_plugins/raw.py b/lib/ansible/runner/action_plugins/raw.py index 88040f2648..5904331102 100644 --- a/lib/ansible/runner/action_plugins/raw.py +++ b/lib/ansible/runner/action_plugins/raw.py @@ -15,7 +15,7 @@ # You should have received a copy of the GNU General Public License # along with Ansible. If not, see . -import shlex +import re import ansible.constants as C from ansible import utils @@ -30,13 +30,13 @@ class ActionModule(object): def run(self, conn, tmp, module_name, module_args, inject): executable = None - args = [] - for arg in shlex.split(module_args.encode("utf-8")): - if arg.startswith('executable='): - executable = arg.split('=', 1)[1] - else: - args.append(arg) - module_args = ' '.join(args) + # From library/command, keep in sync + r = re.compile(r'(^|\s)(executable)=(?P[\'"])?(.*?)(?(quote)(?