Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hbacrule: Allow clearing members with empty lists. #752

Merged
merged 1 commit into from
Feb 21, 2022

Conversation

rjeffman
Copy link
Member

If a hbacrule member has any value, the only way to clear it is by
creating a task with 'state: absent' and 'action: member' and provide
a list with all the values for that member.

This patch allows the use of ': []' with 'action: hbacrule'
to clear a hbacrule member.

Fix #751

Comment on lines 671 to 678
host:
- "{{ 'testhost03.' + ipaserver_domain }}"
- "{{ 'testhost04.' + ipaserver_domain }}"
hostgroup: testhostgroup03,testhostgroup04
user: testuser03,testuser04
group: testgroup03,testgroup04
hbacsvc: testhbacsvc03,testhbacsvc04
hbacsvcgroup: testhbacsvcgroup03,testhbacsvcgroup04
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be good to add a test in the end to make sure that any of these entries are not there anymore after using the empty lists.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added two tests with check_mode: yes to verify if the attributes are empty.

I also refactored the playbook test so that the tests for empty members are in its own test playbook, reducing the size of the base test (which is still too big, IMO).

If a hbacrule member has any value, the only way to clear it is by
creating a task with 'state: absent' and 'action: member' and provide
a list with all the values for that member.

This patch allows the use of '<member>: []' with 'action: hbacrule'
to clear a hbacrule member.

A new test playbook can be found at:

    tests/hbacrule/test_hbacrule_member_empty.yml
@rjeffman rjeffman force-pushed the hbacrule_allow_clearing_members branch from 7e83e5b to 19fc21c Compare February 10, 2022 22:09
Copy link
Member

@t-woerner t-woerner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@t-woerner t-woerner merged commit 9981e5f into freeipa:master Feb 21, 2022
@rjeffman rjeffman deleted the hbacrule_allow_clearing_members branch August 25, 2022 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

hbacrule: can't force a member list to be empty.
2 participants