Skip to content

Commit

Permalink
[PR #8823/ea389e70 backport][stable-9] bugfix(keycloak): fix paramete…
Browse files Browse the repository at this point in the history
…rs for realm key creation (#8840)

bugfix(keycloak): fix parameters for realm key creation (#8823)

* bugfix(keycloak): fix parameters for realm key creation

* supply changelog fragment

* fix formatting

* fix formatting

* Update changelogs/fragments/8823-keycloak-realm-key.yml

Co-authored-by: Felix Fontein <[email protected]>

---------

Co-authored-by: Felix Fontein <[email protected]>
(cherry picked from commit ea389e7)

Co-authored-by: Björn Bösel <[email protected]>
  • Loading branch information
patchback[bot] and fivetide authored Sep 8, 2024
1 parent aca2afc commit 6fec5a7
Show file tree
Hide file tree
Showing 3 changed files with 385 additions and 3 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/8823-keycloak-realm-key.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- keycloak_realm_key - fix invalid usage of ``parent_id`` (https://github.com/ansible-collections/community.general/issues/7850, https://github.com/ansible-collections/community.general/pull/8823).
6 changes: 3 additions & 3 deletions plugins/modules/keycloak_realm_key.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
type: bool
parent_id:
description:
- The parent_id of the realm key. In practice the ID (name) of the realm.
- The parent_id of the realm key. In practice the name of the realm.
type: str
required: true
provider_id:
Expand Down Expand Up @@ -300,7 +300,7 @@ def main():

kc = KeycloakAPI(module, connection_header)

params_to_ignore = list(keycloak_argument_spec().keys()) + ["state", "force"]
params_to_ignore = list(keycloak_argument_spec().keys()) + ["state", "force", "parent_id"]

# Filter and map the parameters names that apply to the role
component_params = [x for x in module.params
Expand Down Expand Up @@ -371,7 +371,7 @@ def main():
parent_id = module.params.get('parent_id')

# Get a list of all Keycloak components that are of keyprovider type.
realm_keys = kc.get_components(urlencode(dict(type=provider_type, parent=parent_id)), parent_id)
realm_keys = kc.get_components(urlencode(dict(type=provider_type)), parent_id)

# If this component is present get its key ID. Confusingly the key ID is
# also known as the Provider ID.
Expand Down
Loading

0 comments on commit 6fec5a7

Please sign in to comment.