mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Make pfexec become usable for illumos (#3889)
* Experimental change from OpenIndiana * resolve pfexec problem, by removing superfluous quotes * reimplement "wrap_exe" * remove spaces arround keyword argument assignment * adapted pfexec unit test * Try to fix quoting of test expression * Fix quoting of test expression by replacing ' with " * Add changelog fragment
This commit is contained in:
parent
96b6ef5765
commit
dc2d3c24fa
3 changed files with 6 additions and 4 deletions
2
changelogs/fragments/3671-illumos-pfexec.yml
Normal file
2
changelogs/fragments/3671-illumos-pfexec.yml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
minor_changes:
|
||||||
|
- "become_pfexec - remove superflous quotes preventing exe wrap from working as expected, fixes #3671, see https://github.com/ansible-collections/community.general/issues/3671#issuecomment-1174906473"
|
|
@ -102,4 +102,4 @@ class BecomeModule(BecomeBase):
|
||||||
|
|
||||||
flags = self.get_option('become_flags')
|
flags = self.get_option('become_flags')
|
||||||
noexe = not self.get_option('wrap_exe')
|
noexe = not self.get_option('wrap_exe')
|
||||||
return '%s %s "%s"' % (exe, flags, self._build_success_command(cmd, shell, noexe=noexe))
|
return '%s %s %s' % (exe, flags, self._build_success_command(cmd, shell, noexe=noexe))
|
||||||
|
|
|
@ -32,7 +32,7 @@ def test_pfexec_basic(mocker, parser, reset_cli_args):
|
||||||
var_options = {}
|
var_options = {}
|
||||||
cmd = call_become_plugin(task, var_options, cmd=default_cmd, executable=default_exe)
|
cmd = call_become_plugin(task, var_options, cmd=default_cmd, executable=default_exe)
|
||||||
print(cmd)
|
print(cmd)
|
||||||
assert re.match('''%s %s "'echo %s; %s'"''' % (pfexec_exe, pfexec_flags, success, default_cmd), cmd) is not None
|
assert re.match("""%s %s 'echo %s; %s'""" % (pfexec_exe, pfexec_flags, success, default_cmd), cmd) is not None
|
||||||
|
|
||||||
|
|
||||||
def test_pfexec(mocker, parser, reset_cli_args):
|
def test_pfexec(mocker, parser, reset_cli_args):
|
||||||
|
@ -54,7 +54,7 @@ def test_pfexec(mocker, parser, reset_cli_args):
|
||||||
var_options = {}
|
var_options = {}
|
||||||
cmd = call_become_plugin(task, var_options, cmd=default_cmd, executable=default_exe)
|
cmd = call_become_plugin(task, var_options, cmd=default_cmd, executable=default_exe)
|
||||||
print(cmd)
|
print(cmd)
|
||||||
assert re.match('''%s %s "'echo %s; %s'"''' % (pfexec_exe, pfexec_flags, success, default_cmd), cmd) is not None
|
assert re.match("""%s %s 'echo %s; %s'""" % (pfexec_exe, pfexec_flags, success, default_cmd), cmd) is not None
|
||||||
|
|
||||||
|
|
||||||
def test_pfexec_varoptions(mocker, parser, reset_cli_args):
|
def test_pfexec_varoptions(mocker, parser, reset_cli_args):
|
||||||
|
@ -79,4 +79,4 @@ def test_pfexec_varoptions(mocker, parser, reset_cli_args):
|
||||||
}
|
}
|
||||||
cmd = call_become_plugin(task, var_options, cmd=default_cmd, executable=default_exe)
|
cmd = call_become_plugin(task, var_options, cmd=default_cmd, executable=default_exe)
|
||||||
print(cmd)
|
print(cmd)
|
||||||
assert re.match('''%s %s "'echo %s; %s'"''' % (pfexec_exe, pfexec_flags, success, default_cmd), cmd) is not None
|
assert re.match("""%s %s 'echo %s; %s'""" % (pfexec_exe, pfexec_flags, success, default_cmd), cmd) is not None
|
||||||
|
|
Loading…
Reference in a new issue