From 8d8df46fe6047fe152019a34508560c3c38e29bb Mon Sep 17 00:00:00 2001 From: Strahinja Kustudic Date: Thu, 13 Sep 2018 08:54:38 +0200 Subject: [PATCH] Add an error message if a pkg cannot be removed, fixes #35672 (#40723) --- lib/ansible/modules/packaging/os/yum.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/ansible/modules/packaging/os/yum.py b/lib/ansible/modules/packaging/os/yum.py index dad69ef8722..15da2b99925 100644 --- a/lib/ansible/modules/packaging/os/yum.py +++ b/lib/ansible/modules/packaging/os/yum.py @@ -1073,6 +1073,10 @@ class YumModule(YumDnf): installed = self.is_installed(repoq, pkg) if installed: + # Return a mesage so it's obvious to the user why yum failed + # and which package couldn't be removed. More details: + # https://github.com/ansible/ansible/issues/35672 + res['msg'] = "Package '%s' couldn't be removed!" % pkg self.module.fail_json(**res) res['changed'] = True @@ -1306,7 +1310,6 @@ class YumModule(YumDnf): return res def ensure(self, repoq): - pkgs = self.names # autoremove was provided without `name`