mirror of
https://github.com/freeipa/ansible-freeipa.git
synced 2026-05-07 13:53:23 +00:00
Do not remove member attributes while updating others
Because of a missing check member attributes (for use with action: member) are cleared when a non-member attribute is changed. The fix simply adds a check for None (parameter not set) to gen_add_del_lists in ansible_freeipa_module to make sure that the parameter is only changed if it should be changed. All places where the add and removal lists have been generated manually have been changed to also use gen_add_del_lists. Resolves: #252 (The "Manager" attribute is removed when updating any user attribute)
This commit is contained in:
@@ -298,6 +298,10 @@ def api_get_realm():
|
||||
|
||||
def gen_add_del_lists(user_list, res_list):
|
||||
"""Generate the lists for the addition and removal of members."""
|
||||
# The user list is None, therefore the parameter should not be touched
|
||||
if user_list is None:
|
||||
return [], []
|
||||
|
||||
add_list = list(set(user_list or []) - set(res_list or []))
|
||||
del_list = list(set(res_list or []) - set(user_list or []))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user