mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-03-21 20:59:10 +00:00
Merge 478cd50be1 into bc22fbcaa0
This commit is contained in:
commit
6f78874f27
2 changed files with 24 additions and 0 deletions
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
bugfixes:
|
||||
- keycloak_clientscope - fixed ``normalise_cr()`` to properly convert string ``"true"`` / ``"false"`` values to Python booleans.
|
||||
Before boolean-like strings caused Ansible to always report ``changed=true`` even when the configuration had not actually changed
|
||||
(https://github.com/ansible-collections/community.general/pull/11296).
|
||||
|
|
@ -300,6 +300,22 @@ from ansible_collections.community.general.plugins.module_utils.identity.keycloa
|
|||
)
|
||||
|
||||
|
||||
def normalise_boolean(obj):
|
||||
"""
|
||||
Recursive fonction to traverse the obj and unify the boolean values.
|
||||
"""
|
||||
if isinstance(obj, dict):
|
||||
return {k: normalise_boolean(v) for k, v in obj.items()}
|
||||
elif isinstance(obj, list):
|
||||
return [normalise_boolean(v) for v in obj]
|
||||
elif isinstance(obj, str):
|
||||
if obj.lower() == "true":
|
||||
return True
|
||||
elif obj.lower() == "false":
|
||||
return False
|
||||
return obj
|
||||
|
||||
|
||||
def normalise_cr(clientscoperep, remove_ids=False):
|
||||
"""Re-sorts any properties where the order so that diff's is minimised, and adds default values where appropriate so that the
|
||||
the change detection is more effective.
|
||||
|
|
@ -320,6 +336,9 @@ def normalise_cr(clientscoperep, remove_ids=False):
|
|||
if remove_ids:
|
||||
mapper.pop("id", None)
|
||||
|
||||
for key, value in mapper.items():
|
||||
mapper[key] = normalise_boolean(value)
|
||||
|
||||
# Set to a default value.
|
||||
mapper["consentRequired"] = mapper.get("consentRequired", False)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue