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:
parent
cfe7c9606c
commit
f0535bac80
4 changed files with 51 additions and 15 deletions
|
@ -430,11 +430,27 @@
|
||||||
|
|
||||||
# ENVIRONMENT UPGRADE
|
# ENVIRONMENT UPGRADE
|
||||||
# see commit de299ef77c03a64a8f515033a79ac6b7db1bc710
|
# see commit de299ef77c03a64a8f515033a79ac6b7db1bc710
|
||||||
- name: install Web Server environment
|
|
||||||
dnf:
|
# Newer Fedora Docker images come with coreutils-single which is incompatible
|
||||||
name: "@Web Server"
|
# with coreutils (required by @Web Server). We force the install of coreutils
|
||||||
state: latest
|
# before running the environment group install.
|
||||||
register: dnf_result
|
# 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
|
- name: verify installation of the environment
|
||||||
assert:
|
assert:
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
dnf:
|
dnf:
|
||||||
name: filesystem
|
name: filesystem
|
||||||
installroot: '/{{dnfroot.stdout}}'
|
installroot: '/{{dnfroot.stdout}}'
|
||||||
releasever: 22
|
releasever: '{{ansible_distribution_version|int - 1}}'
|
||||||
register: dnf_result
|
register: dnf_result
|
||||||
|
|
||||||
- name: check filesystem version
|
- name: check filesystem version
|
||||||
|
@ -40,7 +40,7 @@
|
||||||
- name: verify the version
|
- name: verify the version
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- "rpm_result.stdout.find('fc22') != -1"
|
- "rpm_result.stdout.find('fc' ~ (ansible_distribution_version|int - 1)) != -1"
|
||||||
|
|
||||||
- name: cleanup installroot
|
- name: cleanup installroot
|
||||||
file:
|
file:
|
||||||
|
|
5
test/integration/targets/yum/files/yum.conf
Normal file
5
test/integration/targets/yum/files/yum.conf
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
[main]
|
||||||
|
gpgcheck=1
|
||||||
|
installonly_limit=3
|
||||||
|
clean_requirements_on_remove=True
|
||||||
|
tsflags=nodocs
|
|
@ -120,15 +120,30 @@
|
||||||
that:
|
that:
|
||||||
- "yum_result is successful"
|
- "yum_result is successful"
|
||||||
|
|
||||||
- name: install sos with state latest in check mode with config file param
|
- name: copy yum.conf file in case it is missing
|
||||||
yum: name=sos state=latest conf_file=/etc/yum.conf
|
copy:
|
||||||
check_mode: true
|
src: yum.conf
|
||||||
register: yum_result
|
dest: /etc/yum.conf
|
||||||
- name: verify install sos with state latest in check mode with config file param
|
force: False
|
||||||
assert:
|
register: yum_conf_copy
|
||||||
that:
|
|
||||||
|
- 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"
|
- "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
|
- name: install sos with state latest in check mode
|
||||||
yum: name=sos state=latest
|
yum: name=sos state=latest
|
||||||
check_mode: true
|
check_mode: true
|
||||||
|
@ -742,4 +757,4 @@
|
||||||
# Fedora < 26 has a bug in dnf where package excludes in dnf.conf aren't
|
# 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
|
# actually honored and those releases are EOL'd so we have no expectation they
|
||||||
# will ever be fixed
|
# 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))
|
||||||
|
|
Loading…
Reference in a new issue