From a24f51d9e5348f96450d366ece3300074a062800 Mon Sep 17 00:00:00 2001 From: Sam Doran Date: Wed, 29 Jul 2020 12:08:11 -0400 Subject: [PATCH] package - use existing list of package manages from facts (#70920) --- changelogs/fragments/package-use-manager-from-facts.yaml | 2 ++ lib/ansible/plugins/action/package.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 changelogs/fragments/package-use-manager-from-facts.yaml diff --git a/changelogs/fragments/package-use-manager-from-facts.yaml b/changelogs/fragments/package-use-manager-from-facts.yaml new file mode 100644 index 00000000000..aadc032c55d --- /dev/null +++ b/changelogs/fragments/package-use-manager-from-facts.yaml @@ -0,0 +1,2 @@ +bugfixes: + - package - use list of built in package managers from facts rather than creating a new list diff --git a/lib/ansible/plugins/action/package.py b/lib/ansible/plugins/action/package.py index c16386588df..02687bb8f79 100644 --- a/lib/ansible/plugins/action/package.py +++ b/lib/ansible/plugins/action/package.py @@ -19,6 +19,7 @@ __metaclass__ = type from ansible.errors import AnsibleAction, AnsibleActionFail from ansible.executor.module_common import get_action_args_with_defaults +from ansible.module_utils.facts.system.pkg_mgr import PKG_MGRS from ansible.plugins.action import ActionBase from ansible.utils.display import Display @@ -29,8 +30,7 @@ class ActionModule(ActionBase): TRANSFERS_FILES = False - BUILTIN_PKG_MGR_MODULES = set(['apk', 'apt', 'dnf', 'homebrew', 'installp', 'macports', 'opkg', 'portage', 'pacman', - 'pkg5', 'pkgin', 'pkgng', 'sorcery', 'svr4pkg', 'swdepot', 'swupd', 'urpmi', 'xbps', 'yum', 'zypper']) + BUILTIN_PKG_MGR_MODULES = set([manager['name'] for manager in PKG_MGRS]) def run(self, tmp=None, task_vars=None): ''' handler for package operations '''