Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make pfexec become usable for illumos #3889

Merged
merged 8 commits into from
Oct 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelogs/fragments/3671-illumos-pfexec.yml
Original file line number Diff line number Diff line change
@@ -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"
2 changes: 1 addition & 1 deletion plugins/become/pfexec.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,4 @@ def build_become_command(self, cmd, shell):

flags = self.get_option('become_flags')
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))
felixfontein marked this conversation as resolved.
Show resolved Hide resolved
6 changes: 3 additions & 3 deletions tests/unit/plugins/become/test_pfexec.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def test_pfexec_basic(mocker, parser, reset_cli_args):
var_options = {}
cmd = call_become_plugin(task, var_options, cmd=default_cmd, executable=default_exe)
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):
Expand All @@ -54,7 +54,7 @@ def test_pfexec(mocker, parser, reset_cli_args):
var_options = {}
cmd = call_become_plugin(task, var_options, cmd=default_cmd, executable=default_exe)
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):
Expand All @@ -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)
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