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

@@ -20,13 +20,13 @@ def test_pbrun_basic(mocker, parser, reset_cli_args):
default_cmd = "/bin/foo"
default_exe = "/bin/bash"
pbrun_exe = 'pbrun'
pbrun_flags = ''
pbrun_exe = "pbrun"
pbrun_flags = ""
success = 'BECOME-SUCCESS-.+?'
success = "BECOME-SUCCESS-.+?"
task = {
'become_method': 'community.general.pbrun',
"become_method": "community.general.pbrun",
}
var_options = {}
cmd = call_become_plugin(task, var_options, cmd=default_cmd, executable=default_exe)
@@ -40,20 +40,23 @@ def test_pbrun(mocker, parser, reset_cli_args):
default_cmd = "/bin/foo"
default_exe = "/bin/bash"
pbrun_exe = 'pbrun'
pbrun_flags = ''
pbrun_exe = "pbrun"
pbrun_flags = ""
success = 'BECOME-SUCCESS-.+?'
success = "BECOME-SUCCESS-.+?"
task = {
'become_user': 'foo',
'become_method': 'community.general.pbrun',
'become_flags': pbrun_flags,
"become_user": "foo",
"become_method": "community.general.pbrun",
"become_flags": pbrun_flags,
}
var_options = {}
cmd = call_become_plugin(task, var_options, cmd=default_cmd, executable=default_exe)
print(cmd)
assert re.match(f"""{pbrun_exe} {pbrun_flags} -u {task['become_user']} 'echo {success}; {default_cmd}'""", cmd) is not None
assert (
re.match(f"""{pbrun_exe} {pbrun_flags} -u {task["become_user"]} 'echo {success}; {default_cmd}'""", cmd)
is not None
)
def test_pbrun_var_varoptions(mocker, parser, reset_cli_args):
@@ -62,20 +65,26 @@ def test_pbrun_var_varoptions(mocker, parser, reset_cli_args):
default_cmd = "/bin/foo"
default_exe = "/bin/bash"
pbrun_exe = 'pbrun'
pbrun_flags = ''
pbrun_exe = "pbrun"
pbrun_flags = ""
success = 'BECOME-SUCCESS-.+?'
success = "BECOME-SUCCESS-.+?"
task = {
'become_user': 'foo',
'become_method': 'community.general.pbrun',
'become_flags': 'xxx',
"become_user": "foo",
"become_method": "community.general.pbrun",
"become_flags": "xxx",
}
var_options = {
'ansible_become_user': 'bar',
'ansible_become_flags': pbrun_flags,
"ansible_become_user": "bar",
"ansible_become_flags": pbrun_flags,
}
cmd = call_become_plugin(task, var_options, cmd=default_cmd, executable=default_exe)
print(cmd)
assert re.match(f"""{pbrun_exe} {pbrun_flags} -u {var_options['ansible_become_user']} 'echo {success}; {default_cmd}'""", cmd) is not None
assert (
re.match(
f"""{pbrun_exe} {pbrun_flags} -u {var_options["ansible_become_user"]} 'echo {success}; {default_cmd}'""",
cmd,
)
is not None
)