From 81672bdf624cb72a3d5c64f822cd5c5ab5c8137e Mon Sep 17 00:00:00 2001
From: Rafael Guterres Jeffman <rjeffman@redhat.com>
Date: Thu, 30 Sep 2021 21:19:03 -0300
Subject: [PATCH] service: Use IPAAnsibleModule method to validate arguments.

Use the IPAAnsibleModule.params_fail_if_used method to validate
arguments provided by user.
---
 plugins/modules/ipaservice.py | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/plugins/modules/ipaservice.py b/plugins/modules/ipaservice.py
index 29ef992b..b69a95cb 100644
--- a/plugins/modules/ipaservice.py
+++ b/plugins/modules/ipaservice.py
@@ -335,11 +335,7 @@ def check_parameters(module, state, action, names, parameters):
     else:
         module.fail_json(msg="Invalid state '%s'" % (state))
 
-    for _invalid in invalid:
-        if _invalid in parameters and parameters[_invalid] is not None:
-            module.fail_json(
-                msg="Argument '%s' can not be used with state '%s', "
-                "action '%s'" % (_invalid, state, action))
+    module.params_fail_used_invalid(invalid, state, action)
 
 
 def init_ansible_module():
-- 
GitLab