From d4e92fc720d7c237b74f65d8874ce2ce176a4c62 Mon Sep 17 00:00:00 2001 From: Jean Raby Date: Fri, 4 Mar 2022 13:25:42 -0500 Subject: [PATCH] pacman: user --groups instead of --group (#4312) * s/group/groups/ Pacman accepts --group but the actual option name is --groups. Allows use of other binaries with the same CLI interface as pacman (yay) * changelog * Apply suggestions from code review Co-authored-by: Felix Fontein * Add note regarding pacman compat + --print-format * Update plugins/modules/packaging/os/pacman.py Co-authored-by: Felix Fontein Co-authored-by: Felix Fontein --- changelogs/fragments/4312-pacman-groups.yml | 9 +++++++++ plugins/modules/packaging/os/pacman.py | 9 ++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 changelogs/fragments/4312-pacman-groups.yml diff --git a/changelogs/fragments/4312-pacman-groups.yml b/changelogs/fragments/4312-pacman-groups.yml new file mode 100644 index 0000000000..7160dca416 --- /dev/null +++ b/changelogs/fragments/4312-pacman-groups.yml @@ -0,0 +1,9 @@ +bugfixes: + - pacman - Use ``--groups`` instead of ``--group`` + (https://github.com/ansible-collections/community.general/pull/4312). + +known_issues: + - pacman - binaries specified in the ``executable`` parameter must support + ``--print-format`` in order to be used by this module. + In particular, AUR helper ``yay`` is known not to currently support it + (https://github.com/ansible-collections/community.general/pull/4312). diff --git a/plugins/modules/packaging/os/pacman.py b/plugins/modules/packaging/os/pacman.py index 116ed48e6d..324c9ebccc 100644 --- a/plugins/modules/packaging/os/pacman.py +++ b/plugins/modules/packaging/os/pacman.py @@ -52,7 +52,10 @@ options: executable: description: - - Name of binary to use. This can either be C(pacman) or a pacman compatible AUR helper. + - Path of the binary to use. This can either be C(pacman) or a pacman compatible AUR helper. + - Pacman compatibility is unfortunately ill defined, in particular, this modules makes + extensive use of the C(--print-format) directive which is known not to be implemented by + some AUR helpers (notably, C(yay)). - Beware that AUR helpers might behave unexpectedly and are therefore not recommended. default: pacman type: str @@ -575,7 +578,7 @@ class Pacman(object): installed_groups = defaultdict(set) dummy, stdout, dummy = self.m.run_command( - [self.pacman_path, "--query", "--group"], check_rc=True + [self.pacman_path, "--query", "--groups"], check_rc=True ) # Format of lines: # base-devel file @@ -600,7 +603,7 @@ class Pacman(object): available_groups = defaultdict(set) dummy, stdout, dummy = self.m.run_command( - [self.pacman_path, "--sync", "--group", "--group"], check_rc=True + [self.pacman_path, "--sync", "--groups", "--groups"], check_rc=True ) # Format of lines: # vim-plugins vim-airline