From 23e07a9a17d76ed469ed03805d645503f27f7fde Mon Sep 17 00:00:00 2001
From: Rafael Guterres Jeffman <rjeffman@redhat.com>
Date: Wed, 27 Apr 2022 11:20:55 -0300
Subject: [PATCH] ipaautomountmap: Force setting automountmapname in IPA API
 calls.

The usage of 'automountmapname' is required in all automount map IPA
API calls, and this change ensures that the value is always set as
an argument.
---
 plugins/modules/ipaautomountmap.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/plugins/modules/ipaautomountmap.py b/plugins/modules/ipaautomountmap.py
index 9cca0a98..8f990d24 100644
--- a/plugins/modules/ipaautomountmap.py
+++ b/plugins/modules/ipaautomountmap.py
@@ -123,9 +123,10 @@ class AutomountMap(IPAAnsibleModule):
         self.params_fail_used_invalid(invalid, state)
 
     def get_args(self, mapname, desc):  # pylint: disable=no-self-use
-        _args = {}
-        if mapname:
-            _args["automountmapname"] = mapname
+        # automountmapname is required for all automountmap operations.
+        if not mapname:
+            self.fail_json(msg="automountmapname cannot be None or empty.")
+        _args = {"automountmapname": mapname}
         # An empty string is valid and will clear the attribute.
         if desc is not None:
             _args["description"] = desc
-- 
GitLab