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

ipa_sudorule: Fix issue #25863 (#26285)

This commit is contained in:
Thomas Krahn 2017-09-27 09:51:59 +02:00 committed by ansibot
parent fd91da7297
commit adc8d60764

View file

@ -277,9 +277,22 @@ def ensure(module, client):
client.sudorule_add_host_hostgroup, client.sudorule_add_host_hostgroup,
client.sudorule_remove_host_hostgroup) or changed client.sudorule_remove_host_hostgroup) or changed
if sudoopt is not None: if sudoopt is not None:
changed = client.modify_if_diff(name, ipa_sudorule.get('ipasudoopt', []), sudoopt, # client.modify_if_diff does not work as each option must be removed/added by its own
client.sudorule_add_option_ipasudoopt, ipa_list = ipa_sudorule.get('ipasudoopt', [])
client.sudorule_remove_option_ipasudoopt) or changed module_list = sudoopt
diff = list(set(ipa_list) - set(module_list))
if len(diff) > 0:
changed = True
if not module.check_mode:
for item in diff:
client.sudorule_remove_option_ipasudoopt(name, item)
diff = list(set(module_list) - set(ipa_list))
if len(diff) > 0:
changed = True
if not module.check_mode:
for item in diff:
client.sudorule_add_option_ipasudoopt(name, item)
if user is not None: if user is not None:
changed = category_changed(module, client, 'usercategory', ipa_sudorule) or changed changed = category_changed(module, client, 'usercategory', ipa_sudorule) or changed
changed = client.modify_if_diff(name, ipa_sudorule.get('memberuser_user', []), user, changed = client.modify_if_diff(name, ipa_sudorule.get('memberuser_user', []), user,