From 444fbe871086f4da19e31d5d6bb5c7ed7669ac92 Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Mon, 17 Jun 2024 07:19:48 +0200 Subject: [PATCH] [PR #8514/df7fe19b backport][stable-8] pacman: do not fail if there is nothing to do (#8522) pacman: do not fail if there is nothing to do (#8514) Do not fail if there is nothing to do. (cherry picked from commit df7fe19bbe666f23e2bd247cb1476ca7961b616e) Co-authored-by: Felix Fontein --- changelogs/fragments/8514-pacman-empty.yml | 2 ++ plugins/modules/pacman.py | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 changelogs/fragments/8514-pacman-empty.yml diff --git a/changelogs/fragments/8514-pacman-empty.yml b/changelogs/fragments/8514-pacman-empty.yml new file mode 100644 index 0000000000..c51ba21acc --- /dev/null +++ b/changelogs/fragments/8514-pacman-empty.yml @@ -0,0 +1,2 @@ +bugfixes: + - "paman - do not fail if an empty list of packages has been provided and there is nothing to do (https://github.com/ansible-collections/community.general/pull/8514)." diff --git a/plugins/modules/pacman.py b/plugins/modules/pacman.py index 7f67b91039..f13bde317c 100644 --- a/plugins/modules/pacman.py +++ b/plugins/modules/pacman.py @@ -367,8 +367,9 @@ class Pacman(object): self.install_packages(pkgs) self.success() - # This shouldn't happen... - self.fail("This is a bug") + # This happens if an empty list has been provided for name + self.add_exit_infos(msg='Nothing to do') + self.success() def install_packages(self, pkgs): pkgs_to_install = []