1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-03-22 05:09:12 +00:00

Reformat everything.

This commit is contained in:
Felix Fontein 2025-11-01 12:08:41 +01:00
parent 3f2213791a
commit 340ff8586d
1008 changed files with 61301 additions and 58309 deletions

View file

@ -92,23 +92,21 @@ from ansible.plugins.become import BecomeBase
class BecomeModule(BecomeBase):
name = 'community.general.ksu'
name = "community.general.ksu"
# messages for detecting prompted password issues
fail = ('Password incorrect',)
missing = ('No password given',)
fail = ("Password incorrect",)
missing = ("No password given",)
def check_password_prompt(self, b_output):
''' checks if the expected password prompt exists in b_output '''
"""checks if the expected password prompt exists in b_output"""
prompts = self.get_option('prompt_l10n') or ["Kerberos password for .*@.*:"]
prompts = self.get_option("prompt_l10n") or ["Kerberos password for .*@.*:"]
b_prompt = b"|".join(to_bytes(p) for p in prompts)
return bool(re.match(b_prompt, b_output))
def build_become_command(self, cmd, shell):
super().build_become_command(cmd, shell)
# Prompt handling for ``ksu`` is more complicated, this
@ -118,8 +116,8 @@ class BecomeModule(BecomeBase):
if not cmd:
return cmd
exe = self.get_option('become_exe')
exe = self.get_option("become_exe")
flags = self.get_option('become_flags')
user = self.get_option('become_user')
return f'{exe} {user} {flags} -e {self._build_success_command(cmd, shell)} '
flags = self.get_option("become_flags")
user = self.get_option("become_user")
return f"{exe} {user} {flags} -e {self._build_success_command(cmd, shell)} "