From 583e4a6d6b4643f81bc4e86c9a468d7340039d1f Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Thu, 23 Mar 2023 15:52:16 -0600 Subject: [PATCH 1/2] rhel_facts module must use keyword arguments The rhel_facts module must use keyword arguments. The current code gives this error: ``` Traceback (most recent call last): ... File "/tmp/ansible_ansible.posix.rhel_facts_payload_y10oy_4m/.../rhel_facts.py", line 72, in main TypeError: exit_json() takes 1 positional argument but 2 were given ``` The fix is to use all keyword arguments like other facts plugins. --- plugins/modules/rhel_facts.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/modules/rhel_facts.py b/plugins/modules/rhel_facts.py index 57c15f7..a30622a 100644 --- a/plugins/modules/rhel_facts.py +++ b/plugins/modules/rhel_facts.py @@ -69,7 +69,7 @@ def main(): if os.path.exists("/run/ostree-booted"): ansible_facts['pkg_mgr'] = 'ansible.posix.rhel_rpm_ostree' - module.exit_json(ansible_facts, changed=False) + module.exit_json(ansible_facts=ansible_facts, changed=False) if __name__ == '__main__': From 0e92d30fd3904ab89a90a24c69636fa56e01006e Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Thu, 23 Mar 2023 17:31:31 -0600 Subject: [PATCH 2/2] add changelog fragment --- changelogs/fragments/434-fix-rhel_facts-exit_json.yml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 changelogs/fragments/434-fix-rhel_facts-exit_json.yml diff --git a/changelogs/fragments/434-fix-rhel_facts-exit_json.yml b/changelogs/fragments/434-fix-rhel_facts-exit_json.yml new file mode 100644 index 0000000..dcf16d9 --- /dev/null +++ b/changelogs/fragments/434-fix-rhel_facts-exit_json.yml @@ -0,0 +1,2 @@ +bugfixes: + - rhel_facts - Call exit_json with all keyword arguments