mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Changes to become cmd formatting, per a47c132
This commit is contained in:
parent
316284c56b
commit
3473a3bbec
1 changed files with 4 additions and 4 deletions
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue