[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>
pull/59313/head
Sam Doran 5 years ago committed by Toshio Kuratomi
parent 4e63b681f2
commit 9b1575cfeb

@ -6,6 +6,8 @@
shell: rpm -q python2-dnf shell: rpm -q python2-dnf
register: rpm_result register: rpm_result
ignore_errors: true ignore_errors: true
args:
warn: no
# Don't uninstall python2-dnf with the `dnf` module in case it needs to load # Don't uninstall python2-dnf with the `dnf` module in case it needs to load
# some dnf python files after the package is uninstalled. # 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 # 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. # We want to test that for people who don't want to upgrade their systems.
- include: 'dnf.yml' - include_tasks: dnf.yml
when: when: (ansible_distribution == 'Fedora' and ansible_distribution_major_version is version('23', '>=')) or
- ansible_distribution == 'Fedora' (ansible_distribution == 'RedHat' and ansible_distribution_major_version is version('8', '>='))
- ansible_distribution_major_version|int >= 23
- include: 'repo.yml' - include_tasks: repo.yml
when: when: (ansible_distribution == 'Fedora' and ansible_distribution_major_version is version('23', '>=')) or
- ansible_distribution == 'Fedora' (ansible_distribution == 'RedHat' and ansible_distribution_major_version is version('8', '>='))
- ansible_distribution_major_version|int >= 23
- include: 'dnfinstallroot.yml' - include_tasks: dnfinstallroot.yml
when: when: (ansible_distribution == 'Fedora' and ansible_distribution_major_version is version('23', '>=')) or
- ansible_distribution == 'Fedora' (ansible_distribution == 'RedHat' and ansible_distribution_major_version is version('8', '>='))
- ansible_distribution_major_version|int >= 23
- include: 'dnfreleasever.yml' # Attempting to install a different RHEL release in a tmpdir doesn't work (rhel8 beta)
- include_tasks: dnfreleasever.yml
when: when:
- ansible_distribution == 'Fedora' - ansible_distribution == 'Fedora'
- ansible_distribution_major_version|int >= 23 - ansible_distribution_major_version is version('23', '>=')
- import_tasks: 'modularity.yml' - include_tasks: modularity.yml
when: when: (ansible_distribution == 'Fedora' and ansible_distribution_major_version is version('29', '>=')) or
- ansible_distribution == 'Fedora' and ansible_distribution_major_version|int >= 29 (ansible_distribution == 'RedHat' and ansible_distribution_major_version is version('8', '>='))
- ansible_distribution == 'RedHat' and ansible_distribution_major_version|int >= 8

@ -1,13 +1,6 @@
# FUTURE - look at including AppStream support in our local repo # FUTURE - look at including AppStream support in our local repo
- name: set package for RHEL - name: Include distribution specific variables
set_fact: include_vars: "{{ ansible_facts.distribution }}.yml"
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: install "@postgresql:9.6/client" module - name: install "@postgresql:9.6/client" module
dnf: dnf:
@ -48,7 +41,7 @@
- name: uninstall "@postgresql:9.6/client" module again - name: uninstall "@postgresql:9.6/client" module again
dnf: dnf:
name: "@postgresql:9.6/client" name: "@postgresql:9.6/client"
state: install state: absent
register: dnf_result register: dnf_result
- name: verify uninstallation of "@postgresql:9.6/client" module again - name: verify uninstallation of "@postgresql:9.6/client" module again

@ -0,0 +1 @@
astream_name: '@ripgrep:master/default'

@ -0,0 +1 @@
astream_name: '@php:7.1/minimal'
Loading…
Cancel
Save