Skip to content
Snippets Groups Projects
Commit 80abf635 authored by Thomas Woerner's avatar Thomas Woerner
Browse files

ipagroup: Fix ensuring external group group members (without trust-ad)

Due to an API misbehaviour in FreeIPA, ipaexternalmembers need to be
treated differently than other group members parameters. Even an empty
array triggers all tests for external members, including the check for
installed dcerpc bindings.

Therefore ipagroup module has been changed to not set ipaexternalmember
to an empty list if there are no external members to be added or
removed.
parent 24e05d1d
No related branches found
No related tags found
No related merge requests found
...@@ -593,10 +593,12 @@ def main(): ...@@ -593,10 +593,12 @@ def main():
del_member_args["service"] = service_del del_member_args["service"] = service_del
if is_external_group(res_find): if is_external_group(res_find):
add_member_args["ipaexternalmember"] = \ if len(externalmember_add) > 0:
externalmember_add add_member_args["ipaexternalmember"] = \
del_member_args["ipaexternalmember"] = \ externalmember_add
externalmember_del if len(externalmember_del) > 0:
del_member_args["ipaexternalmember"] = \
externalmember_del
elif externalmember or external: elif externalmember or external:
ansible_module.fail_json( ansible_module.fail_json(
msg="Cannot add external members to a " msg="Cannot add external members to a "
......
---
- name: Test external group group members (without trust-ad installed)
hosts: ipaserver
become: true
tasks:
- name: Ensure external test groups are absent
ipagroup:
ipaadmin_password: SomeADMINpassword
name:
- externaltestgroup01
- externaltestgroup02
state: absent
- name: Create external test group 01
ipagroup:
ipaadmin_password: SomeADMINpassword
name: externaltestgroup01
external: true
register: result
failed_when: result.failed or not result.changed
- name: Create external test group 02
ipagroup:
ipaadmin_password: SomeADMINpassword
name: externaltestgroup02
external: true
register: result
failed_when: result.failed or not result.changed
- name: Ensure externaltestgroup02 is a member of externaltestgroup01
ipagroup:
ipaadmin_password: SomeADMINpassword
name: externaltestgroup01
action: member
group:
- externaltestgroup02
register: result
failed_when: result.failed or not result.changed
- name: Ensure externaltestgroup02 is a member of externaltestgroup01, again
ipagroup:
ipaadmin_password: SomeADMINpassword
name: externaltestgroup01
action: member
group:
- externaltestgroup02
register: result
failed_when: result.failed or result.changed
- name: Ensure externaltestgroup02 is not a member of externaltestgroup01
ipagroup:
ipaadmin_password: SomeADMINpassword
name: externaltestgroup01
action: member
group:
- externaltestgroup02
state: absent
register: result
failed_when: result.failed or not result.changed
- name: Ensure externaltestgroup02 is not a member of externaltestgroup01, again
ipagroup:
ipaadmin_password: SomeADMINpassword
name: externaltestgroup01
action: member
group:
- externaltestgroup02
state: absent
register: result
failed_when: result.failed or result.changed
- name: Ensure external test groups are absent
ipagroup:
ipaadmin_password: SomeADMINpassword
name:
- externaltestgroup01
- externaltestgroup02
state: absent
register: result
failed_when: result.failed or not result.changed
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment