From 94a7de568c6857cd67767f6726d435e585c0fafd Mon Sep 17 00:00:00 2001 From: Sam Doran Date: Tue, 3 Dec 2019 16:20:29 -0500 Subject: [PATCH] [stable-2.9] Fix setup_rpm integration tests for CentOS 8 (#64862) (#64915) (cherry picked from commit 5d2a3ecbc4) Co-authored-by: Sam Doran --- .../targets/setup_rpm_repo/defaults/main.yml | 0 .../targets/setup_rpm_repo/tasks/main.yml | 56 ++++++------------- .../targets/setup_rpm_repo/vars/Fedora.yml | 3 + .../targets/setup_rpm_repo/vars/RedHat-6.yml | 4 ++ .../targets/setup_rpm_repo/vars/RedHat-7.yml | 4 ++ .../targets/setup_rpm_repo/vars/RedHat-8.yml | 4 ++ .../targets/setup_rpm_repo/vars/main.yml | 1 + 7 files changed, 33 insertions(+), 39 deletions(-) create mode 100644 test/integration/targets/setup_rpm_repo/defaults/main.yml create mode 100644 test/integration/targets/setup_rpm_repo/vars/Fedora.yml create mode 100644 test/integration/targets/setup_rpm_repo/vars/RedHat-6.yml create mode 100644 test/integration/targets/setup_rpm_repo/vars/RedHat-7.yml create mode 100644 test/integration/targets/setup_rpm_repo/vars/RedHat-8.yml create mode 100644 test/integration/targets/setup_rpm_repo/vars/main.yml diff --git a/test/integration/targets/setup_rpm_repo/defaults/main.yml b/test/integration/targets/setup_rpm_repo/defaults/main.yml new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/integration/targets/setup_rpm_repo/tasks/main.yml b/test/integration/targets/setup_rpm_repo/tasks/main.yml index 21805109af5..637c3b7fd0f 100644 --- a/test/integration/targets/setup_rpm_repo/tasks/main.yml +++ b/test/integration/targets/setup_rpm_repo/tasks/main.yml @@ -6,52 +6,30 @@ - ansible_distribution in ['RedHat'] - ansible_distribution_major_version is version('7', '==') - - name: Install rpmfluff and deps - package: - name: "{{ item }}" - with_items: - - python{{ ansible_python_version.split(".")[0] }}-rpmfluff - - createrepo - when: - - ansible_distribution in ['Fedora'] + - name: Include distribution specific variables + include_vars: "{{ lookup('first_found', params) }}" + vars: + params: + files: + - "{{ ansible_facts.distribution }}-{{ ansible_facts.distribution_version }}.yml" + - "{{ ansible_facts.os_family }}-{{ ansible_facts.distribution_major_version }}.yml" + - "{{ ansible_facts.distribution }}.yml" + - "{{ ansible_facts.os_family }}.yml" + - default.yml + paths: + - "{{ role_path }}/vars" - name: Install rpmfluff and deps - package: - name: "{{ item }}" - with_items: - - python-rpmfluff - - createrepo_c - - createrepo # used by el6 version of rpmfluff - when: - - ansible_distribution not in ['Fedora'] - - ansible_python["version"]["major"] == 2 - - - name: Install rpmfluff and deps - package: - name: "{{ item }}" - with_items: - - python3-rpmfluff - - createrepo_c - - createrepo # used by el6 version of rpmfluff - when: - - ansible_distribution not in ['Fedora'] - - ansible_python["version"]["major"] == 3 - - not (ansible_distribution == 'RedHat' and ansible_distribution_major_version is version('8', '>=')) + action: "{{ ansible_facts.pkg_mgr }}" + args: + name: "{{ rpm_repo_packages }}" - name: Install rpmfluff from pip on RHEL 8 and later pip: name: rpmfluff when: - - ansible_distribution == 'RedHat' and ansible_distribution_major_version is version('8', '>=') - - - name: Install packages needed on RHEL 8 and later - dnf: - name: "{{ item }}" - with_items: - - createrepo_c - - rpm-build - when: - - ansible_distribution == 'RedHat' and ansible_distribution_major_version is version('8', '>=') + - ansible_facts.distribution in ['RedHat', 'CentOS'] + - ansible_facts.distribution_major_version is version('8', '>=') - name: Copy script for creating a repo copy: diff --git a/test/integration/targets/setup_rpm_repo/vars/Fedora.yml b/test/integration/targets/setup_rpm_repo/vars/Fedora.yml new file mode 100644 index 00000000000..6e8fdaaaf12 --- /dev/null +++ b/test/integration/targets/setup_rpm_repo/vars/Fedora.yml @@ -0,0 +1,3 @@ +rpm_repo_packages: + - "{{ 'python' ~ rpm_repo_python_major_version ~ '-rpmfluff' }}" + - createrepo diff --git a/test/integration/targets/setup_rpm_repo/vars/RedHat-6.yml b/test/integration/targets/setup_rpm_repo/vars/RedHat-6.yml new file mode 100644 index 00000000000..69615d2cc08 --- /dev/null +++ b/test/integration/targets/setup_rpm_repo/vars/RedHat-6.yml @@ -0,0 +1,4 @@ +rpm_repo_packages: + - python-rpmfluff + - createrepo_c + - createrepo diff --git a/test/integration/targets/setup_rpm_repo/vars/RedHat-7.yml b/test/integration/targets/setup_rpm_repo/vars/RedHat-7.yml new file mode 100644 index 00000000000..69615d2cc08 --- /dev/null +++ b/test/integration/targets/setup_rpm_repo/vars/RedHat-7.yml @@ -0,0 +1,4 @@ +rpm_repo_packages: + - python-rpmfluff + - createrepo_c + - createrepo diff --git a/test/integration/targets/setup_rpm_repo/vars/RedHat-8.yml b/test/integration/targets/setup_rpm_repo/vars/RedHat-8.yml new file mode 100644 index 00000000000..84849e2341c --- /dev/null +++ b/test/integration/targets/setup_rpm_repo/vars/RedHat-8.yml @@ -0,0 +1,4 @@ +rpm_repo_packages: + - rpm-build + - createrepo_c + - createrepo diff --git a/test/integration/targets/setup_rpm_repo/vars/main.yml b/test/integration/targets/setup_rpm_repo/vars/main.yml new file mode 100644 index 00000000000..8e924fce627 --- /dev/null +++ b/test/integration/targets/setup_rpm_repo/vars/main.yml @@ -0,0 +1 @@ +rpm_repo_python_major_version: "{{ ansible_facts.python_version.split('.')[0] }}"