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

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

diff --git a/plugins/modules/ipadnsrecord.py b/plugins/modules/ipadnsrecord.py
index 69b9212a..9f8d2772 100644
--- a/plugins/modules/ipadnsrecord.py
+++ b/plugins/modules/ipadnsrecord.py
@@ -1201,11 +1201,7 @@ def check_parameters(module, state, zone_name, record):
         invalid = list(_PART_MAP.keys())
         invalid.extend(['create_reverse', 'dns_ttl'])
 
-    for x in invalid:
-        if x in record:
-            module.fail_json(
-                msg="Variable `%s` cannot be used in state `%s`" %
-                    (x, state))
+    module.params_fail_used_invalid(invalid, state)
 
 
 def get_entry_from_module(module, name):
-- 
GitLab