From bf4e5dc3c06f5b6fa31bf41cbaf66b30a79b1fec Mon Sep 17 00:00:00 2001
From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com>
Date: Wed, 2 Oct 2024 09:55:34 +0300
Subject: [PATCH] [PR #8923/83080cc0 backport][stable-9] keycloak_userprofile:
 fix empty response by removing `parent` filter when fetching userprofile
 component (#8960)

keycloak_userprofile: fix empty response by removing `parent` filter when fetching userprofile component (#8923)

* remove parent filter when fetching userprofile component

* add changelog fragment

* Update changelogs/fragments/8923-keycloak_userprofile-fix-empty-response-when-fetching-userprofile.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 83080cc0054b62c0c4624e66ce4501cf14fc0b21)

Co-authored-by: fgruenbauer <gruenbauer@b1-systems.de>
---
 ...userprofile-fix-empty-response-when-fetching-userprofile.yml | 2 ++
 plugins/modules/keycloak_userprofile.py                         | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)
 create mode 100644 changelogs/fragments/8923-keycloak_userprofile-fix-empty-response-when-fetching-userprofile.yml

diff --git a/changelogs/fragments/8923-keycloak_userprofile-fix-empty-response-when-fetching-userprofile.yml b/changelogs/fragments/8923-keycloak_userprofile-fix-empty-response-when-fetching-userprofile.yml
new file mode 100644
index 0000000000..5b3c18ba2c
--- /dev/null
+++ b/changelogs/fragments/8923-keycloak_userprofile-fix-empty-response-when-fetching-userprofile.yml
@@ -0,0 +1,2 @@
+bugfixes:
+  - keycloak_userprofile - fix empty response when fetching userprofile component by removing ``parent=parent_id`` filter (https://github.com/ansible-collections/community.general/pull/8923).
\ No newline at end of file
diff --git a/plugins/modules/keycloak_userprofile.py b/plugins/modules/keycloak_userprofile.py
index ba5dc127d2..55971cbf42 100644
--- a/plugins/modules/keycloak_userprofile.py
+++ b/plugins/modules/keycloak_userprofile.py
@@ -641,7 +641,7 @@ def main():
     changeset_copy = deepcopy(changeset)
 
     # Get a list of all Keycloak components that are of userprofile provider type.
-    realm_userprofiles = kc.get_components(urlencode(dict(type=provider_type, parent=parent_id)), parent_id)
+    realm_userprofiles = kc.get_components(urlencode(dict(type=provider_type)), parent_id)
 
     # If this component is present get its userprofile ID. Confusingly the userprofile ID is
     # also known as the Provider ID.