yum: use Custom Group in integration tests (#56439)

pull/56731/head
Martin Krizek 6 years ago committed by Sam Doran
parent 7f5b1e998f
commit 77f997474a

@ -1,26 +1,12 @@
# test code for the yum module
# (c) 2014, James Tanner <tanner.jc@gmail.com> # (c) 2014, James Tanner <tanner.jc@gmail.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
# 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.
- block: - block:
- include: 'yum.yml' - import_tasks: yum.yml
always: always:
- name: remove installed packages - name: remove installed packages
yum: yum:
@ -29,49 +15,48 @@
- sos - sos
state: absent state: absent
# On CentOS 6 'yum groupremove "Development Tools"' fails when groupremove_leaf_only
# isn't enabled, that's why a package belonging to "Development Tools" (autoconf)
# is removed instead of the whole group.
- name: remove installed group - name: remove installed group
yum: yum:
name: "@Development tools" name: "@Custom Group"
state: absent state: absent
when:
- (ansible_distribution in ['RedHat', 'CentOS', 'ScientificLinux'] and ansible_distribution_major_version|int > 6) or ansible_distribution in ['Fedora'] - name: On Fedora 28 the above won't remove the group which results in a failure in repo.yml below
- name: remove a package from a group
yum: yum:
name: 'autoconf' name: foo
state: absent state: absent
when: when:
- ansible_distribution in ['RedHat', 'CentOS', 'ScientificLinux'] and ansible_distribution_major_version|int <= 6 - ansible_distribution in ['Fedora']
when: when:
- ansible_distribution in ['RedHat', 'CentOS', 'ScientificLinux', 'Fedora'] - ansible_distribution in ['RedHat', 'CentOS', 'ScientificLinux', 'Fedora']
# DNF1 doesn't handle downgrade operations properly (Fedora < 26)
- block: - block:
- include: 'repo.yml' - import_tasks: repo.yml
- import_tasks: yum_group_remove.yml
when:
- ansible_distribution in ['RedHat', 'CentOS', 'ScientificLinux']
always: always:
- yum_repository: - yum_repository:
name: "{{ item }}" name: "{{ item }}"
state: absent state: absent
with_items: "{{ repos }}" loop: "{{ repos }}"
- command: yum clean metadata - command: yum clean metadata
when: when:
- ansible_distribution in ['RedHat', 'CentOS', 'ScientificLinux', 'Fedora'] - ansible_distribution in ['RedHat', 'CentOS', 'ScientificLinux', 'Fedora']
- include: 'yuminstallroot.yml'
- import_tasks: yuminstallroot.yml
when: when:
- ansible_distribution in ['RedHat', 'CentOS', 'ScientificLinux', 'Fedora'] - ansible_distribution in ['RedHat', 'CentOS', 'ScientificLinux', 'Fedora']
# el6 has a broken yum group implementation, when you try to remove a group it goes through
# deps and ends up with trying to remove yum itself and the whole process fails - import_tasks: proxy.yml
# so don't run the yum group remove tests there
- include: 'yum_group_remove.yml'
when: when:
- (ansible_distribution in ['RedHat', 'CentOS', 'ScientificLinux'] and ansible_distribution_major_version|int > 6) - ansible_distribution in ['RedHat', 'CentOS', 'ScientificLinux', 'Fedora']
- include: 'proxy.yml'
- include: 'check_mode_consistency.yml' - import_tasks: check_mode_consistency.yml
when: when:
- (ansible_distribution in ['RedHat', 'CentOS', 'ScientificLinux'] and ansible_distribution_major_version|int == 7) - (ansible_distribution in ['RedHat', 'CentOS', 'ScientificLinux'] and ansible_distribution_major_version|int == 7)

@ -394,7 +394,7 @@
- name: install group - name: install group
yum: yum:
name: "@Development Tools" name: "@Custom Group"
state: present state: present
register: yum_result register: yum_result
@ -413,7 +413,7 @@
- name: install the group again - name: install the group again
yum: yum:
name: "@Development Tools" name: "@Custom Group"
state: present state: present
register: yum_result register: yum_result
@ -433,7 +433,7 @@
- name: install the group again but also with a package that is not yet installed - name: install the group again but also with a package that is not yet installed
yum: yum:
name: name:
- "@Development Tools" - "@Custom Group"
- sos - sos
state: present state: present
register: yum_result register: yum_result
@ -453,7 +453,7 @@
- name: try to install the group again, with --check to check 'changed' - name: try to install the group again, with --check to check 'changed'
yum: yum:
name: "@Development Tools" name: "@Custom Group"
state: present state: present
check_mode: yes check_mode: yes
register: yum_result register: yum_result

@ -3,7 +3,7 @@
name: "{{ item }}" name: "{{ item }}"
state: present state: present
with_items: with_items:
- "@Development Tools" - "@Custom Group"
- yum-utils - yum-utils
when: ansible_pkg_mgr == "yum" when: ansible_pkg_mgr == "yum"
@ -12,13 +12,13 @@
name: "{{ item }}" name: "{{ item }}"
state: present state: present
with_items: with_items:
- "@Development Tools" - "@Custom Group"
- dnf-utils - dnf-utils
when: ansible_pkg_mgr == "dnf" when: ansible_pkg_mgr == "dnf"
- name: check mode remove the group - name: check mode remove the group
yum: yum:
name: "@Development Tools" name: "@Custom Group"
state: absent state: absent
check_mode: yes check_mode: yes
register: yum_result register: yum_result
@ -36,7 +36,7 @@
- name: remove the group - name: remove the group
yum: yum:
name: "@Development Tools" name: "@Custom Group"
state: absent state: absent
register: yum_result register: yum_result
@ -55,7 +55,7 @@
- name: remove the group again - name: remove the group again
yum: yum:
name: "@Development Tools" name: "@Custom Group"
state: absent state: absent
register: yum_result register: yum_result
@ -73,7 +73,7 @@
- name: check mode remove the group again - name: check mode remove the group again
yum: yum:
name: "@Development Tools" name: "@Custom Group"
state: absent state: absent
check_mode: yes check_mode: yes
register: yum_result register: yum_result
@ -91,13 +91,13 @@
- name: install a group and a package to test - name: install a group and a package to test
yum: yum:
name: "@Development Tools,sos" name: "@Custom Group,sos"
state: present state: present
register: yum_output register: yum_output
- name: check mode remove the group along with the package - name: check mode remove the group along with the package
yum: yum:
name: "@Development Tools,sos" name: "@Custom Group,sos"
state: absent state: absent
register: yum_result register: yum_result
check_mode: yes check_mode: yes
@ -115,7 +115,7 @@
- name: remove the group along with the package - name: remove the group along with the package
yum: yum:
name: "@Development Tools,sos" name: "@Custom Group,sos"
state: absent state: absent
register: yum_result register: yum_result
@ -133,7 +133,7 @@
- name: check mode remove the group along with the package - name: check mode remove the group along with the package
yum: yum:
name: "@Development Tools,sos" name: "@Custom Group,sos"
state: absent state: absent
register: yum_result register: yum_result
check_mode: yes check_mode: yes

Loading…
Cancel
Save