From 5d6324e2daa6488894f51c8f222130e5ba1451d2 Mon Sep 17 00:00:00 2001 From: Rafael Guterres Jeffman <rjeffman@redhat.com> Date: Thu, 3 Feb 2022 15:42:04 -0300 Subject: [PATCH] module templates: Add example and note for case insensitive members. Some modules should be compared in a case insensitive manner, and this patch adds an example of a call to IPAAnsibleModule.params_get_lowercase and a note on its usage. --- utils/templates/ipamodule+member.py.in | 5 ++++- utils/templates/ipamodule.py.in | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/utils/templates/ipamodule+member.py.in b/utils/templates/ipamodule+member.py.in index f0c2edb9..90152502 100644 --- a/utils/templates/ipamodule+member.py.in +++ b/utils/templates/ipamodule+member.py.in @@ -163,7 +163,10 @@ def main(): # present PARAMETER1 = ansible_module.params_get("PARAMETER1") - PARAMETER2 = ansible_module.params_get("PARAMETER2") + # Note: some parameters must be compared in a case insensitive way, + # or are transliterated into its lowercase version by IPA API. For + # these parameters, use IPAAnsibleModule.params_get_lowercase. + PARAMETER2 = ansible_module.params_get_lowercase("PARAMETER2") action = ansible_module.params_get("action") # state diff --git a/utils/templates/ipamodule.py.in b/utils/templates/ipamodule.py.in index 00750f83..b66be523 100644 --- a/utils/templates/ipamodule.py.in +++ b/utils/templates/ipamodule.py.in @@ -135,7 +135,10 @@ def main(): # present PARAMETER1 = ansible_module.params_get("PARAMETER1") - PARAMETER2 = ansible_module.params_get("PARAMETER2") + # Note: some parameters must be compared in a case insensitive way, + # or are transliterated into its lowercase version by IPA API. For + # these parameters, use IPAAnsibleModule.params_get_lowercase. + PARAMETER2 = ansible_module.params_get_lowercase("PARAMETER2") # state state = ansible_module.params_get("state") -- GitLab