mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
rename function to normalize
This commit is contained in:
parent
54624b51fc
commit
7b4dd2ed2a
1 changed files with 4 additions and 4 deletions
|
@ -721,7 +721,7 @@ from ansible.module_utils.six.moves.urllib.parse import urlencode
|
|||
from copy import deepcopy
|
||||
|
||||
|
||||
def normalize_kc_comp(comp):
|
||||
def normalize(comp):
|
||||
norm_comp = deepcopy(comp)
|
||||
if 'config' in norm_comp:
|
||||
# kc stores a timestamp of the last sync in `lastSync` to time the periodic sync, it is removed to minimize diff/changes
|
||||
|
@ -887,7 +887,7 @@ def main():
|
|||
if cid is not None and before_comp:
|
||||
before_comp['mappers'] = sorted(kc.get_components(urlencode(dict(parent=cid)), realm), key=lambda x: x.get('name'))
|
||||
|
||||
before_comp = normalize_kc_comp(before_comp)
|
||||
before_comp = normalize(before_comp)
|
||||
|
||||
# Build a proposed changeset from parameters given to this module
|
||||
changeset = {}
|
||||
|
@ -997,7 +997,7 @@ def main():
|
|||
kc.delete_component(default_mapper['id'], realm)
|
||||
|
||||
after_comp['mappers'] = kc.get_components(urlencode(dict(parent=cid)), realm)
|
||||
after_comp = normalize_kc_comp(after_comp)
|
||||
after_comp = normalize(after_comp)
|
||||
if module._diff:
|
||||
result['diff'] = dict(before='', after=sanitize(after_comp))
|
||||
result['end_state'] = sanitize(after_comp)
|
||||
|
@ -1045,7 +1045,7 @@ def main():
|
|||
|
||||
after_comp = kc.get_component(cid, realm)
|
||||
after_comp['mappers'] = kc.get_components(urlencode(dict(parent=cid)), realm)
|
||||
after_comp_sanitized = sanitize(normalize_kc_comp(after_comp))
|
||||
after_comp_sanitized = sanitize(normalize(after_comp))
|
||||
before_comp_sanitized = sanitize(before_comp)
|
||||
result['end_state'] = after_comp_sanitized
|
||||
if module._diff:
|
||||
|
|
Loading…
Add table
Reference in a new issue