From 9d269ee8caa4f4ce4464c4abf79f3c9f8f08d544 Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Mon, 30 Mar 2026 21:43:39 +0200 Subject: [PATCH] [PR #11698/47ef322a backport][stable-12] ipa module utils: detect and fail on errors in API response `failed` field (#11710) ipa module utils: detect and fail on errors in API response `failed` field (#11698) * ipa_* modules: detect and fail on errors in API response ``failed`` field Fixes: https://github.com/ansible-collections/community.general/issues/1239 * fix chglog frag * adjust chglog frag --------- (cherry picked from commit 47ef322a5f92dd1b9e7a4f35ea9c1233423c2eda) Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.6 --- changelogs/fragments/11698-ipa-failed-response.yml | 4 ++++ plugins/module_utils/ipa.py | 3 +++ 2 files changed, 7 insertions(+) create mode 100644 changelogs/fragments/11698-ipa-failed-response.yml diff --git a/changelogs/fragments/11698-ipa-failed-response.yml b/changelogs/fragments/11698-ipa-failed-response.yml new file mode 100644 index 0000000000..b27e294789 --- /dev/null +++ b/changelogs/fragments/11698-ipa-failed-response.yml @@ -0,0 +1,4 @@ +bugfixes: + - "ipa module utils - fix failure to detect errors reported in the ``failed`` field of the IPA API response, + which is returned with HTTP 200 on partial or full failures in member add/remove operations + (https://github.com/ansible-collections/community.general/issues/1239, https://github.com/ansible-collections/community.general/pull/11698)." diff --git a/plugins/module_utils/ipa.py b/plugins/module_utils/ipa.py index 50acb4c480..0dfca11cc2 100644 --- a/plugins/module_utils/ipa.py +++ b/plugins/module_utils/ipa.py @@ -159,6 +159,9 @@ class IPAClient: if "result" in resp: result = resp.get("result") + failed = result.get("failed") + if failed: + self._fail(f"response {method}", failed) if "result" in result: result = result.get("result") if isinstance(result, list):