From 3473a3bbece56e15a957fd5252d14e5775becb6b Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Tue, 17 Mar 2015 10:50:41 -0500 Subject: [PATCH] Changes to become cmd formatting, per a47c132 --- v2/ansible/executor/connection_info.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/v2/ansible/executor/connection_info.py b/v2/ansible/executor/connection_info.py index 0ae51e6b612..26a14a23f9d 100644 --- a/v2/ansible/executor/connection_info.py +++ b/v2/ansible/executor/connection_info.py @@ -194,8 +194,8 @@ class ConnectionInformation: prompt = '[sudo via ansible, key=%s] password: ' % randbits exe = become_settings.get('sudo_exe', C.DEFAULT_SUDO_EXE) flags = become_settings.get('sudo_flags', C.DEFAULT_SUDO_FLAGS) - becomecmd = '%s -k && %s %s -S -p "%s" -u %s %s -c "%s"' % \ - (exe, exe, flags or C.DEFAULT_SUDO_FLAGS, prompt, self.become_user, executable, 'echo %s; %s' % (success_key, cmd)) + becomecmd = '%s -k && %s %s -S -p "%s" -u %s %s -c %s' % \ + (exe, exe, flags or C.DEFAULT_SUDO_FLAGS, prompt, self.become_user, executable, pipes.quote('echo %s; %s' % (success_key, cmd))) elif self.become_method == 'su': exe = become_settings.get('su_exe', C.DEFAULT_SU_EXE) @@ -205,13 +205,13 @@ class ConnectionInformation: elif self.become_method == 'pbrun': exe = become_settings.get('pbrun_exe', 'pbrun') flags = become_settings.get('pbrun_flags', '') - becomecmd = '%s -b -l %s -u %s "%s"' % (exe, flags, self.become_user, 'echo %s; %s' % (success_key,cmd)) + becomecmd = '%s -b -l %s -u %s "%s"' % (exe, flags, user, pipes.quote('echo %s; %s' % (success_key, cmd))) elif self.become_method == 'pfexec': exe = become_settings.get('pfexec_exe', 'pbrun') flags = become_settings.get('pfexec_flags', '') # No user as it uses it's own exec_attr to figure it out - becomecmd = '%s %s "%s"' % (exe, flags, 'echo %s; %s' % (success_key,cmd)) + becomecmd = '%s %s "%s"' % (exe, flags, pipes.quote('echo %s; %s' % (success_key, cmd))) else: raise errors.AnsibleError("Privilege escalation method not found: %s" % method)