[stable-2.7] Improve dnf test formatting and fix RHEL 8 module name (#58648)
- use single include_vars task rather than multiple set_fact tasks
- use multi-line YAML to break up long conditionals
- use version() test rather than direct comparisions
- use different appstream package on RHEL since '@swig:3.0/default' is not working in the GA.
(cherry picked from commit 16d6fcf514
)
Co-authored-by: Sam Doran <sdoran@redhat.com>
This commit is contained in:
parent
4e63b681f2
commit
9b1575cfeb
5 changed files with 25 additions and 31 deletions
|
@ -6,6 +6,8 @@
|
|||
shell: rpm -q python2-dnf
|
||||
register: rpm_result
|
||||
ignore_errors: true
|
||||
args:
|
||||
warn: no
|
||||
|
||||
# Don't uninstall python2-dnf with the `dnf` module in case it needs to load
|
||||
# some dnf python files after the package is uninstalled.
|
||||
|
|
|
@ -19,27 +19,24 @@
|
|||
# Note: We install the yum package onto Fedora so that this will work on dnf systems
|
||||
# We want to test that for people who don't want to upgrade their systems.
|
||||
|
||||
- include: 'dnf.yml'
|
||||
- include_tasks: dnf.yml
|
||||
when: (ansible_distribution == 'Fedora' and ansible_distribution_major_version is version('23', '>=')) or
|
||||
(ansible_distribution == 'RedHat' and ansible_distribution_major_version is version('8', '>='))
|
||||
|
||||
- include_tasks: repo.yml
|
||||
when: (ansible_distribution == 'Fedora' and ansible_distribution_major_version is version('23', '>=')) or
|
||||
(ansible_distribution == 'RedHat' and ansible_distribution_major_version is version('8', '>='))
|
||||
|
||||
- include_tasks: dnfinstallroot.yml
|
||||
when: (ansible_distribution == 'Fedora' and ansible_distribution_major_version is version('23', '>=')) or
|
||||
(ansible_distribution == 'RedHat' and ansible_distribution_major_version is version('8', '>='))
|
||||
|
||||
# Attempting to install a different RHEL release in a tmpdir doesn't work (rhel8 beta)
|
||||
- include_tasks: dnfreleasever.yml
|
||||
when:
|
||||
- ansible_distribution == 'Fedora'
|
||||
- ansible_distribution_major_version|int >= 23
|
||||
- ansible_distribution_major_version is version('23', '>=')
|
||||
|
||||
- include: 'repo.yml'
|
||||
when:
|
||||
- ansible_distribution == 'Fedora'
|
||||
- ansible_distribution_major_version|int >= 23
|
||||
|
||||
- include: 'dnfinstallroot.yml'
|
||||
when:
|
||||
- ansible_distribution == 'Fedora'
|
||||
- ansible_distribution_major_version|int >= 23
|
||||
|
||||
- include: 'dnfreleasever.yml'
|
||||
when:
|
||||
- ansible_distribution == 'Fedora'
|
||||
- ansible_distribution_major_version|int >= 23
|
||||
|
||||
- import_tasks: 'modularity.yml'
|
||||
when:
|
||||
- ansible_distribution == 'Fedora' and ansible_distribution_major_version|int >= 29
|
||||
- ansible_distribution == 'RedHat' and ansible_distribution_major_version|int >= 8
|
||||
- include_tasks: modularity.yml
|
||||
when: (ansible_distribution == 'Fedora' and ansible_distribution_major_version is version('29', '>=')) or
|
||||
(ansible_distribution == 'RedHat' and ansible_distribution_major_version is version('8', '>='))
|
||||
|
|
|
@ -1,13 +1,6 @@
|
|||
# FUTURE - look at including AppStream support in our local repo
|
||||
- name: set package for RHEL
|
||||
set_fact:
|
||||
astream_name: '@swig:3.0/default'
|
||||
when: ansible_distribution == 'RedHat'
|
||||
|
||||
- name: set package for Fedora
|
||||
set_fact:
|
||||
astream_name: '@ripgrep:master/default'
|
||||
when: ansible_distribution == 'Fedora'
|
||||
- name: Include distribution specific variables
|
||||
include_vars: "{{ ansible_facts.distribution }}.yml"
|
||||
|
||||
- name: install "@postgresql:9.6/client" module
|
||||
dnf:
|
||||
|
@ -48,7 +41,7 @@
|
|||
- name: uninstall "@postgresql:9.6/client" module again
|
||||
dnf:
|
||||
name: "@postgresql:9.6/client"
|
||||
state: install
|
||||
state: absent
|
||||
register: dnf_result
|
||||
|
||||
- name: verify uninstallation of "@postgresql:9.6/client" module again
|
||||
|
|
1
test/integration/targets/dnf/vars/Fedora.yml
Normal file
1
test/integration/targets/dnf/vars/Fedora.yml
Normal file
|
@ -0,0 +1 @@
|
|||
astream_name: '@ripgrep:master/default'
|
1
test/integration/targets/dnf/vars/RedHat.yml
Normal file
1
test/integration/targets/dnf/vars/RedHat.yml
Normal file
|
@ -0,0 +1 @@
|
|||
astream_name: '@php:7.1/minimal'
|
Loading…
Reference in a new issue