1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

yum: fix reporting group changes in check_mode (#28331)

This commit is contained in:
Martin Krizek 2017-08-22 16:35:23 -04:00 committed by Sam Doran
parent 84005498bc
commit 711ae03845
2 changed files with 33 additions and 3 deletions

View file

@ -744,9 +744,20 @@ def install(module, items, repoq, yum_basecmd, conf_file, en_repos, dis_repos, i
continue continue
pkg = package pkg = package
#groups :( # groups
elif spec.startswith('@'): elif spec.startswith('@'):
# complete wild ass guess b/c it's a group found = False
my = yum_base()
groups_list = my.doGroupLists()
for group in groups_list[0]: # list of the installed groups on the first index
spec_lower = spec.lower()
if spec_lower.endswith(group.name.lower()) or spec_lower.endswith(group.groupid.lower()):
found = True
break
if found:
continue
pkg = spec pkg = spec
# range requires or file-requires or pkgname :( # range requires or file-requires or pkgname :(

View file

@ -255,7 +255,7 @@
state: present state: present
register: yum_result register: yum_result
- name: verify nothing changed - name: verify sos is installed
assert: assert:
that: that:
- "yum_result.rc == 0" - "yum_result.rc == 0"
@ -269,6 +269,25 @@
- "'rc' in yum_result" - "'rc' in yum_result"
- "'results' in yum_result" - "'results' in yum_result"
- name: try to install the group again, with --check to check 'changed'
yum:
name: "@Development Tools"
state: present
check_mode: yes
register: yum_result
- name: verify nothing 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: try to install non existing group - name: try to install non existing group
yum: yum:
name: "@non-existing-group" name: "@non-existing-group"