1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

dnf yum: fix tests running on Fedora 29 (#47910)

* dnf yum: fix tests running on Fedora 29

* wrap in always block
This commit is contained in:
Jordan Borean 2018-11-02 02:20:29 +10:00 committed by ansibot
parent cfe7c9606c
commit f0535bac80
4 changed files with 51 additions and 15 deletions

View file

@ -430,11 +430,27 @@
# ENVIRONMENT UPGRADE
# see commit de299ef77c03a64a8f515033a79ac6b7db1bc710
- name: install Web Server environment
dnf:
name: "@Web Server"
state: latest
register: dnf_result
# Newer Fedora Docker images come with coreutils-single which is incompatible
# with coreutils (required by @Web Server). We force the install of coreutils
# before running the environment group install.
# https://github.com/fedora-cloud/docker-brew-fedora/issues/58
- name: ensure coreutils is installed over coreutils-single
command: dnf install --allowerasing -y coreutils
changed_when: '"Nothing to do" not in coreutils_install.stdout'
register: coreutils_install
- block:
- name: install Web Server environment
dnf:
name: "@Web Server"
state: latest
register: dnf_result
always:
- name: reinstall coreutils-single if coreutils was installed
command: dnf install --allowerasing -y coreutils-single
when: coreutils_install is changed
- name: verify installation of the environment
assert:

View file

@ -19,7 +19,7 @@
dnf:
name: filesystem
installroot: '/{{dnfroot.stdout}}'
releasever: 22
releasever: '{{ansible_distribution_version|int - 1}}'
register: dnf_result
- name: check filesystem version
@ -40,7 +40,7 @@
- name: verify the version
assert:
that:
- "rpm_result.stdout.find('fc22') != -1"
- "rpm_result.stdout.find('fc' ~ (ansible_distribution_version|int - 1)) != -1"
- name: cleanup installroot
file:

View file

@ -0,0 +1,5 @@
[main]
gpgcheck=1
installonly_limit=3
clean_requirements_on_remove=True
tsflags=nodocs

View file

@ -120,15 +120,30 @@
that:
- "yum_result is successful"
- name: install sos with state latest in check mode with config file param
yum: name=sos state=latest conf_file=/etc/yum.conf
check_mode: true
register: yum_result
- name: verify install sos with state latest in check mode with config file param
assert:
that:
- name: copy yum.conf file in case it is missing
copy:
src: yum.conf
dest: /etc/yum.conf
force: False
register: yum_conf_copy
- block:
- name: install sos with state latest in check mode with config file param
yum: name=sos state=latest conf_file=/etc/yum.conf
check_mode: true
register: yum_result
- name: verify install sos with state latest in check mode with config file param
assert:
that:
- "yum_result is changed"
always:
- name: remove tmp yum.conf file if we created it
file:
path: /etc/yum.conf
state: absent
when: yum_conf_copy is changed
- name: install sos with state latest in check mode
yum: name=sos state=latest
check_mode: true
@ -742,4 +757,4 @@
# Fedora < 26 has a bug in dnf where package excludes in dnf.conf aren't
# actually honored and those releases are EOL'd so we have no expectation they
# will ever be fixed
when: not ((ansible_distribution == "Fedora") and (ansible_distribution_major_version|int < 26))
when: not ((ansible_distribution == "Fedora") and (ansible_distribution_major_version|int < 26))