summaryrefslogtreecommitdiffstats
path: root/test/integration/targets/package
diff options
context:
space:
mode:
authorAdam Miller <admiller@redhat.com>2018-07-23 16:56:09 +0200
committeransibot <ansibot@users.noreply.github.com>2018-07-23 16:56:09 +0200
commit562ff66a987cbf7db53608fdf3981c7bb7118c30 (patch)
tree3c790d79c8dddd4bda2a27f9db6f73b5e394b640 /test/integration/targets/package
parentExplicitly pass HTTP method to fetch_url (diff)
downloadansible-562ff66a987cbf7db53608fdf3981c7bb7118c30.tar.xz
ansible-562ff66a987cbf7db53608fdf3981c7bb7118c30.zip
Fix pkg_mgr_name fact finding for Fedora (#40922)
* Properly handle default package manager vs apt For distros where apt might be installed but is not the default package manager for the distro, properly identify the default distro package manager during fact finding and re-use fact finding from DistributionFactCollector and instead of reimplementing small portions of it in PkgMgrFactCollector Add unit test to always check the apt + Fedora combination to test the new code. Fixes #34014 Signed-off-by: Adam Miller <admiller@redhat.com> * remove q debugging output I accidentally left behind Signed-off-by: Adam Miller <admiller@redhat.com> * add os_family to the conditional so we're only hitting that code path when needed Signed-off-by: Adam Miller <admiller@redhat.com> * setup for a _check* pattern for general os_family group pkg_mgr checking Signed-off-by: Adam Miller <admiller@redhat.com> * use Mock.patch decorator for os.path.exists in TestPkgMgrFactsAptFedora Signed-off-by: Adam Miller <admiller@redhat.com>
Diffstat (limited to 'test/integration/targets/package')
-rw-r--r--test/integration/targets/package/tasks/main.yml24
1 files changed, 23 insertions, 1 deletions
diff --git a/test/integration/targets/package/tasks/main.yml b/test/integration/targets/package/tasks/main.yml
index 5fc7a5a01d..0ce58739ef 100644
--- a/test/integration/targets/package/tasks/main.yml
+++ b/test/integration/targets/package/tasks/main.yml
@@ -24,11 +24,33 @@
- name: create our testing sub-directory
file: path="{{ output_dir_test }}" state=directory
+# Verify correct default package manager for Fedora
+# Validates: https://github.com/ansible/ansible/issues/34014
+- block:
+ - name: install apt
+ dnf:
+ name: apt
+ state: present
+ - name: gather facts again
+ setup:
+ - name: validate output
+ assert:
+ that:
+ - 'ansible_pkg_mgr == "dnf"'
+ always:
+ - name: remove apt
+ dnf:
+ name: apt
+ state: absent
+ - name: gather facts again
+ setup:
+ when: ansible_distribution == "Fedora"
+
##
## package
##
-- name: define distros to attempt installing at on
+- name: define distros to attempt installing at on
set_fact:
package_distros:
- RedHat