mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-08-03 20:54:24 -07:00
yum: fix changed in group remove
This commit is contained in:
parent
9aa5e0cc3e
commit
98b19f0623
3 changed files with 190 additions and 35 deletions
|
@ -19,14 +19,23 @@
|
|||
# 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: 'yum.yml'
|
||||
when: ansible_distribution in ['RedHat', 'CentOS', 'ScientificLinux', 'Fedora'] and
|
||||
ansible_python.version.major == 2
|
||||
when:
|
||||
- ansible_distribution in ['RedHat', 'CentOS', 'ScientificLinux', 'Fedora']
|
||||
- ansible_python.version.major == 2
|
||||
|
||||
# We can't run yum --installroot tests on dnf systems. Dnf systems revert to
|
||||
# yum-deprecated, and yum-deprecated refuses to run if yum.conf exists
|
||||
# so we cannot configure yum-deprecated correctly in an empty /tmp/fake.root/
|
||||
# It will always run with $releasever unset
|
||||
- include: 'yuminstallroot.yml'
|
||||
when: (ansible_distribution in ['RedHat', 'CentOS', 'ScientificLinux'] or
|
||||
(ansible_distribution in ['Fedora'] and ansible_distribution_major_version|int < 23)) and
|
||||
ansible_python.version.major == 2
|
||||
when:
|
||||
- (ansible_distribution in ['RedHat', 'CentOS', 'ScientificLinux'] or (ansible_distribution in ['Fedora'] and ansible_distribution_major_version|int < 23))
|
||||
- ansible_python.version.major == 2
|
||||
|
||||
# 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
|
||||
# so don't run the yum group remove tests there
|
||||
- include: 'yum_group_remove.yml'
|
||||
when:
|
||||
- (ansible_distribution in ['RedHat', 'CentOS', 'ScientificLinux'] and ansible_distribution_major_version|int > 6) or ansible_distribution in ['Fedora']
|
||||
- ansible_python.version.major == 2
|
||||
|
|
142
test/integration/targets/yum/tasks/yum_group_remove.yml
Normal file
142
test/integration/targets/yum/tasks/yum_group_remove.yml
Normal file
|
@ -0,0 +1,142 @@
|
|||
- name: install a group to test and yum-utils
|
||||
yum:
|
||||
name: "{{ item }}"
|
||||
state: present
|
||||
with_items:
|
||||
- "@Development Tools"
|
||||
- yum-utils
|
||||
|
||||
- name: check mode remove the group
|
||||
yum:
|
||||
name: "@Development Tools"
|
||||
state: absent
|
||||
check_mode: yes
|
||||
register: yum_result
|
||||
|
||||
- name: verify changed
|
||||
assert:
|
||||
that:
|
||||
- "yum_result.changed"
|
||||
|
||||
- name: verify yum module outputs
|
||||
assert:
|
||||
that:
|
||||
- "'changed' in yum_result"
|
||||
- "'results' in yum_result"
|
||||
|
||||
- name: remove the group
|
||||
yum:
|
||||
name: "@Development Tools"
|
||||
state: absent
|
||||
register: yum_result
|
||||
|
||||
- name: verify changed
|
||||
assert:
|
||||
that:
|
||||
- "yum_result.rc == 0"
|
||||
- "yum_result.changed"
|
||||
|
||||
- name: verify yum module outputs
|
||||
assert:
|
||||
that:
|
||||
- "'changed' in yum_result"
|
||||
- "'msg' in yum_result"
|
||||
- "'results' in yum_result"
|
||||
|
||||
- name: remove the group again
|
||||
yum:
|
||||
name: "@Development Tools"
|
||||
state: absent
|
||||
register: yum_result
|
||||
|
||||
- name: verify changed
|
||||
assert:
|
||||
that:
|
||||
- "not yum_result.changed"
|
||||
|
||||
- name: verify yum module outputs
|
||||
assert:
|
||||
that:
|
||||
- "'changed' in yum_result"
|
||||
- "'msg' in yum_result"
|
||||
- "'results' in yum_result"
|
||||
|
||||
- name: check mode remove the group again
|
||||
yum:
|
||||
name: "@Development Tools"
|
||||
state: absent
|
||||
check_mode: yes
|
||||
register: yum_result
|
||||
|
||||
- name: verify changed
|
||||
assert:
|
||||
that:
|
||||
- "not yum_result.changed"
|
||||
|
||||
- name: verify yum module outputs
|
||||
assert:
|
||||
that:
|
||||
- "'changed' in yum_result"
|
||||
- "'results' in yum_result"
|
||||
|
||||
- name: install a group and a package to test
|
||||
yum:
|
||||
name: "@Development Tools,sos"
|
||||
state: present
|
||||
register: yum_output
|
||||
|
||||
- debug: var=yum_output
|
||||
|
||||
- name: check mode remove the group along with the package
|
||||
yum:
|
||||
name: "@Development Tools,sos"
|
||||
state: absent
|
||||
register: yum_result
|
||||
check_mode: yes
|
||||
|
||||
- name: verify changed
|
||||
assert:
|
||||
that:
|
||||
- "yum_result.changed"
|
||||
|
||||
- name: verify yum module outputs
|
||||
assert:
|
||||
that:
|
||||
- "'changed' in yum_result"
|
||||
- "'results' in yum_result"
|
||||
|
||||
- name: remove the group along with the package
|
||||
yum:
|
||||
name: "@Development Tools,sos"
|
||||
state: absent
|
||||
register: yum_result
|
||||
|
||||
- name: verify changed
|
||||
assert:
|
||||
that:
|
||||
- "yum_result.changed"
|
||||
|
||||
- name: verify yum module outputs
|
||||
assert:
|
||||
that:
|
||||
- "'changed' in yum_result"
|
||||
- "'msg' in yum_result"
|
||||
- "'results' in yum_result"
|
||||
|
||||
- name: check mode remove the group along with the package
|
||||
yum:
|
||||
name: "@Development Tools,sos"
|
||||
state: absent
|
||||
register: yum_result
|
||||
check_mode: yes
|
||||
|
||||
- name: verify not changed
|
||||
assert:
|
||||
that:
|
||||
- "not yum_result.changed"
|
||||
|
||||
- name: verify yum module outputs
|
||||
assert:
|
||||
that:
|
||||
- "'changed' in yum_result"
|
||||
- "'results' in yum_result"
|
Loading…
Add table
Add a link
Reference in a new issue