From 015b922c1fd6680e95b46aa0aa81121396f485c7 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Mon, 3 Aug 2015 18:48:49 -0400 Subject: [PATCH] fix quoting for become commands fixes #11808 --- lib/ansible/playbook/play_context.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/ansible/playbook/play_context.py b/lib/ansible/playbook/play_context.py index edff062ca86..466f59702c6 100644 --- a/lib/ansible/playbook/play_context.py +++ b/lib/ansible/playbook/play_context.py @@ -336,7 +336,6 @@ class PlayContext(Base): becomecmd = None randbits = ''.join(chr(random.randint(ord('a'), ord('z'))) for x in xrange(32)) success_key = 'BECOME-SUCCESS-%s' % randbits - #executable = executable or '$SHELL' success_cmd = pipes.quote('echo %s; %s' % (success_key, cmd)) if self.become_method == 'sudo': @@ -381,7 +380,7 @@ class PlayContext(Base): self.prompt = prompt self.success_key = success_key - return ('%s -c ' % executable) + pipes.quote(becomecmd) + return ('%s -c %s' % (executable, pipes.quote(becomecmd))) return cmd