mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-02 14:40:19 -07:00
become flags are primary
with new configuration the sudo flags are always set and become cannot override, switching to simle 'or' will result in become_flags working. also sudo_flags are deprecated. also changed from YAML null causing a 'None' str fixes #30629
This commit is contained in:
parent
0eb0d96286
commit
236d13ac3a
2 changed files with 6 additions and 12 deletions
|
@ -528,19 +528,13 @@ class PlayContext(Base):
|
|||
command = success_cmd
|
||||
|
||||
# set executable to use for the privilege escalation method, with various overrides
|
||||
exe = self.become_method
|
||||
for myexe in (getattr(self, '%s_exe' % self.become_method, None), self.become_exe):
|
||||
if myexe:
|
||||
exe = myexe
|
||||
break
|
||||
exe = self.become_exe or getattr(self, '%s_exe' % self.become_method, self.become_method)
|
||||
|
||||
# set flags to use for the privilege escalation method, with various overrides
|
||||
flags = ''
|
||||
for myflag in (getattr(self, '%s_flags' % self.become_method, None), self.become_flags):
|
||||
if myflag is not None:
|
||||
flags = myflag
|
||||
break
|
||||
flags = self.become_flags or getattr(self, '%s_flags' % self.become_method, '')
|
||||
|
||||
print(exe)
|
||||
print(flags)
|
||||
if self.become_method == 'sudo':
|
||||
# If we have a password, we run sudo with a randomly-generated
|
||||
# prompt set using -p. Otherwise we run it with default -n, which makes
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue