From 3390d6742db61c3fcd8da83d2827c4269494237c Mon Sep 17 00:00:00 2001
From: Thomas Woerner <twoerner@redhat.com>
Date: Wed, 9 Oct 2019 11:55:15 +0200
Subject: [PATCH] ansible_freeipa_module: New function api_check_param

api_check_param can be used to verify if params are available for a command
in the used FreeIPA version. The function has been added as api is normally
not imported into modules.
---
 plugins/module_utils/ansible_freeipa_module.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/plugins/module_utils/ansible_freeipa_module.py b/plugins/module_utils/ansible_freeipa_module.py
index cd7fcec2..e477f50c 100644
--- a/plugins/module_utils/ansible_freeipa_module.py
+++ b/plugins/module_utils/ansible_freeipa_module.py
@@ -127,6 +127,13 @@ def api_command(module, command, name, args):
     return api.Command[command](name, **args)
 
 
+def api_check_param(command, name):
+    """
+    Return if param exists in command param list
+    """
+    return name in api.Command[command].params
+
+
 def execute_api_command(module, principal, password, command, name, args):
     """
     Get KRB ticket if not already there, initialize api, connect,
-- 
GitLab