Changes to become cmd formatting, per a47c132

This commit is contained in:
James Cammarata 2015-03-17 10:50:41 -05:00
parent 316284c56b
commit 3473a3bbec

View file

@ -194,8 +194,8 @@ class ConnectionInformation:
prompt = '[sudo via ansible, key=%s] password: ' % randbits prompt = '[sudo via ansible, key=%s] password: ' % randbits
exe = become_settings.get('sudo_exe', C.DEFAULT_SUDO_EXE) exe = become_settings.get('sudo_exe', C.DEFAULT_SUDO_EXE)
flags = become_settings.get('sudo_flags', C.DEFAULT_SUDO_FLAGS) flags = become_settings.get('sudo_flags', C.DEFAULT_SUDO_FLAGS)
becomecmd = '%s -k && %s %s -S -p "%s" -u %s %s -c "%s"' % \ 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)) (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': elif self.become_method == 'su':
exe = become_settings.get('su_exe', C.DEFAULT_SU_EXE) exe = become_settings.get('su_exe', C.DEFAULT_SU_EXE)
@ -205,13 +205,13 @@ class ConnectionInformation:
elif self.become_method == 'pbrun': elif self.become_method == 'pbrun':
exe = become_settings.get('pbrun_exe', 'pbrun') exe = become_settings.get('pbrun_exe', 'pbrun')
flags = become_settings.get('pbrun_flags', '') 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': elif self.become_method == 'pfexec':
exe = become_settings.get('pfexec_exe', 'pbrun') exe = become_settings.get('pfexec_exe', 'pbrun')
flags = become_settings.get('pfexec_flags', '') flags = become_settings.get('pfexec_flags', '')
# No user as it uses it's own exec_attr to figure it out # 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: else:
raise errors.AnsibleError("Privilege escalation method not found: %s" % method) raise errors.AnsibleError("Privilege escalation method not found: %s" % method)