mirror of
https://github.com/ansible/ansible.git
synced 2026-07-28 16:15:12 +02:00
This reverts commit dfc1f8d6f5.
This commit is contained in:
@@ -1,2 +0,0 @@
|
||||
bugfixes:
|
||||
- sudo become plugin is now compatible with sudo-rs (rust implementation).
|
||||
@@ -101,17 +101,6 @@ class BecomeModule(BecomeBase):
|
||||
fail = ('Sorry, try again.',)
|
||||
missing = ('Sorry, a password is required to run sudo', 'sudo: a password is required')
|
||||
|
||||
def check_password_prompt(self, b_output):
|
||||
matched = super().check_password_prompt(b_output)
|
||||
if not matched:
|
||||
# might be using sudo-rs, which is not backwards compatible
|
||||
prompt = self.prompt
|
||||
self.prompt = f"[sudo: {prompt}] Password:" # handle extra text from sudo-rs
|
||||
matched = super().check_password_prompt(b_output)
|
||||
self.prompt = prompt
|
||||
|
||||
return matched
|
||||
|
||||
def build_become_command(self, cmd, shell):
|
||||
super(BecomeModule, self).build_become_command(cmd, shell)
|
||||
|
||||
@@ -123,7 +112,7 @@ class BecomeModule(BecomeBase):
|
||||
flags = self.get_option('become_flags') or ''
|
||||
prompt = ''
|
||||
if self.get_option('become_pass'):
|
||||
self.prompt = f'[sudo via ansible, key={self._id}] password:'
|
||||
self.prompt = '[sudo via ansible, key=%s] password:' % self._id
|
||||
if flags: # this could be simplified, but kept as is for now for backwards string matching
|
||||
reflag = []
|
||||
for flag in shlex.split(flags):
|
||||
@@ -135,11 +124,11 @@ class BecomeModule(BecomeBase):
|
||||
reflag.append(flag)
|
||||
flags = shlex.join(reflag)
|
||||
|
||||
prompt = f'-p "{self.prompt}"'
|
||||
prompt = '-p "%s"' % (self.prompt)
|
||||
|
||||
user = self.get_option('become_user') or ''
|
||||
if user:
|
||||
user = f'-u {user}'
|
||||
user = '-u %s' % (user)
|
||||
|
||||
if chdir := self.get_option('sudo_chdir'):
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user