Blame SOURCES/ansible-freeipa-0.3.8-Replace-json_query-in-tests-user-test_users_absent.y_rhbz#1992997.patch

aa04dd
From 545d1c742231ea3151a6b0474de4c198dcbc8604 Mon Sep 17 00:00:00 2001
aa04dd
From: Thomas Woerner <twoerner@redhat.com>
aa04dd
Date: Wed, 11 Aug 2021 11:24:36 +0200
aa04dd
Subject: [PATCH] Replace json_query in tests/user/test_users_absent.yml
aa04dd
aa04dd
json_query is not part of Ansible Core. As this is the only used module
aa04dd
that is not in Core it has been replaced by constructig a new dict with
aa04dd
the needed user names from users dict using a loop and set_fact.
aa04dd
---
aa04dd
 tests/user/test_users_absent.yml | 7 ++++++-
aa04dd
 1 file changed, 6 insertions(+), 1 deletion(-)
aa04dd
aa04dd
diff --git a/tests/user/test_users_absent.yml b/tests/user/test_users_absent.yml
aa04dd
index 752b241..d211816 100644
aa04dd
--- a/tests/user/test_users_absent.yml
aa04dd
+++ b/tests/user/test_users_absent.yml
aa04dd
@@ -12,8 +12,13 @@
aa04dd
     include_vars:
aa04dd
       file: users.json
aa04dd
 
aa04dd
+  - name: Create dict with user names
aa04dd
+    set_fact:
aa04dd
+      user_names: "{{ user_names | default([]) + [{ 'name': item.name }] }}"
aa04dd
+    loop: "{{ users }}"
aa04dd
+
aa04dd
   - name: Users absent len:{{ users | length }}
aa04dd
     ipauser:
aa04dd
       ipaadmin_password: SomeADMINpassword
aa04dd
-      users: "{{ users | json_query('[*].{name: name}') }}"
aa04dd
+      users: "{{ user_names }}"
aa04dd
       state: absent
aa04dd
-- 
aa04dd
2.31.1
aa04dd