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

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

diff --git a/plugins/modules/ipaprivilege.py b/plugins/modules/ipaprivilege.py
index 7b32468f..82d65c36 100644
--- a/plugins/modules/ipaprivilege.py
+++ b/plugins/modules/ipaprivilege.py
@@ -205,11 +205,7 @@ def main():
                 msg="Action '%s' can not be used with state '%s'"
                     % (action, state))
 
-    for x in invalid:
-        if vars()[x] is not None:
-            ansible_module.fail_json(
-                msg="Argument '%s' can not be used with action "
-                "'%s' and state '%s'" % (x, action, state))
+    ansible_module.params_fail_used_invalid(invalid, state, action)
 
     # Init
 
-- 
GitLab