summaryrefslogtreecommitdiff
path: root/test/integration/targets/yum
diff options
context:
space:
mode:
authorAdam Miller <admiller@redhat.com>2020-04-23 02:02:00 -0500
committerGitHub <noreply@github.com>2020-04-23 09:02:00 +0200
commit8b30360ca98cf9fa9694f86d122b18da68c14c96 (patch)
tree6007d838a481534f9c67ac3aa3c7ecfe11aa9a50 /test/integration/targets/yum
parentcace616aab91480f2139dc7b14d7d13929f34104 (diff)
downloadansible-8b30360ca98cf9fa9694f86d122b18da68c14c96.tar.gz
fixed handling of releasever for all known scenarios (#69057)
Signed-off-by: Adam Miller <admiller@redhat.com>
Diffstat (limited to 'test/integration/targets/yum')
-rw-r--r--test/integration/targets/yum/tasks/yuminstallroot.yml60
1 files changed, 60 insertions, 0 deletions
diff --git a/test/integration/targets/yum/tasks/yuminstallroot.yml b/test/integration/targets/yum/tasks/yuminstallroot.yml
index 24c3516de6..2a6bd3f804 100644
--- a/test/integration/targets/yum/tasks/yuminstallroot.yml
+++ b/test/integration/targets/yum/tasks/yuminstallroot.yml
@@ -60,3 +60,63 @@
file:
path: "{{ yumroot.stdout }}/"
state: absent
+
+# Test for releasever working correctly
+#
+# Bugfix: https://github.com/ansible/ansible/issues/67050
+#
+# This test case is based on a reproducer originally reported on Reddit:
+# https://www.reddit.com/r/ansible/comments/g2ps32/ansible_yum_module_throws_up_an_error_when/
+#
+# NOTE: For the Ansible upstream CI we can only run this for RHEL7 because the
+# containerized runtimes in shippable don't allow the nested mounting of
+# buildah container volumes.
+- name: perform yuminstallroot in a buildah mount with releasever
+ when:
+ - ansible_facts["distribution_major_version"] == "7"
+ - ansible_facts["distribution"] == "RedHat"
+ block:
+ # Need to enable this RHUI repo for RHEL7 testing in AWS, CentOS has Extras
+ # enabled by default and this is not needed there.
+ - name: enable rhui-rhel-7-server-rhui-extras-rpms repo for RHEL7
+ command: yum-config-manager --enable rhui-rhel-7-server-rhui-extras-rpms
+ - name: update cache to pull repodata
+ yum:
+ update_cache: yes
+ - name: install required packages for buildah test
+ yum:
+ state: present
+ name:
+ - buildah
+ - name: create buildah container from scratch
+ command: "buildah --name yum_installroot_releasever_test from scratch"
+ - name: mount the buildah container
+ command: "buildah mount yum_installroot_releasever_test"
+ register: buildah_mount
+ - name: figure out yum value of $releasever
+ shell: python -c 'import yum; yb = yum.YumBase(); print(yb.conf.yumvar["releasever"])' | tail -1
+ register: buildah_host_releasever
+ - name: test yum install of python using releasever
+ yum:
+ name: 'python'
+ state: present
+ installroot: "{{ buildah_mount.stdout }}"
+ releasever: "{{ buildah_host_releasever.stdout }}"
+ register: yum_result
+ - name: verify installation of python
+ assert:
+ that:
+ - "yum_result.rc == 0"
+ - "yum_result.changed"
+ - "rpm_result.rc == 0"
+ always:
+ - name: remove buildah container
+ command: "buildah rm yum_installroot_releasever_test"
+ ignore_errors: yes
+ - name: remove buildah from CI system
+ yum:
+ state: absent
+ name:
+ - buildah
+ - name: disable rhui-rhel-7-server-rhui-extras-rpms repo for RHEL7
+ command: yum-config-manager --disable rhui-rhel-7-server-rhui-extras-rpms