diff --git a/plugins/modules/ipaautomountmap.py b/plugins/modules/ipaautomountmap.py index 9cca0a9852fa98be8aa4553752f5ea995df8a47e..67857c62d37f4ce782e65b5da6e6f70e994b73b5 100644 --- a/plugins/modules/ipaautomountmap.py +++ b/plugins/modules/ipaautomountmap.py @@ -112,20 +112,21 @@ class AutomountMap(IPAAnsibleModule): state = self.params_get("state") if state == "present": if len(name) != 1: - self.fail_json(msg="Exactly one name must be provided \ - for state=present.") + self.fail_json(msg="Exactly one name must be provided for" + " 'state: present'.") if state == "absent": if len(name) == 0: - self.fail_json(msg="Argument 'map_type' can not be used with " - "state 'absent'") + self.fail_json(msg="At least one 'name' must be provided for" + " 'state: absent'") invalid = ["desc"] 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