Blob Blame History Raw
From 4da89de1d41a752e561d17f628dd6c2cbda3f326 Mon Sep 17 00:00:00 2001
From: Rafael Guterres Jeffman <rjeffman@redhat.com>
Date: Wed, 21 Sep 2022 10:10:52 -0300
Subject: [PATCH] ipaconfig: Fix fail_json calls.

Ansible's fail_json() method required that the message paramater was
passed with a keyword parameter, rather than a positional one. Although
this seems to work with ansible-core 2.13+, it might not work with
previous versions of Ansible.

This patch fixes the behaviour for all supported Ansible versions.
---
 plugins/modules/ipaconfig.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/plugins/modules/ipaconfig.py b/plugins/modules/ipaconfig.py
index b0b4062..87810b2 100644
--- a/plugins/modules/ipaconfig.py
+++ b/plugins/modules/ipaconfig.py
@@ -533,13 +533,14 @@ def main():
             required_sid = any([netbios_name, add_sids])
             if required_sid and not enable_sid:
                 ansible_module.fail_json(
-                    "'enable-sid: yes' required for 'netbios_name' "
-                    "and 'add-sids'."
+                    msg="'enable-sid: yes' required for 'netbios_name' "
+                        "and 'add-sids'."
                 )
             if enable_sid:
                 if not has_enable_sid:
                     ansible_module.fail_json(
-                        "This version of IPA does not support 'enable-sid'.")
+                        msg="This version of IPA does not support enable-sid."
+                    )
                 if (
                     netbios_name
                     and netbios_name == get_netbios_name(ansible_module)
-- 
2.37.3