ipaautomountmap: Allows clearing description attribute with "".

This change allows clearing automountmap 'description' attribute by
passing an empty string ("") as the playbook parameter.

New test cases were added to check this behavior.
This commit is contained in:
Rafael Guterres Jeffman
2022-02-22 18:09:58 -03:00
parent 70f4b7d646
commit a83bab9425
2 changed files with 20 additions and 1 deletions

View File

@@ -126,7 +126,8 @@ class AutomountMap(IPAAnsibleModule):
_args = {}
if mapname:
_args["automountmapname"] = mapname
if desc:
# An empty string is valid and will clear the attribute.
if desc is not None:
_args["description"] = desc
return _args

View File

@@ -71,6 +71,24 @@
register: result
failed_when: result.failed or result.changed
- name: ensure map TestMap has an empty description
ipaautomountmap:
ipaadmin_password: SomeADMINpassword
name: TestMap
location: TestLocation
desc: ""
register: result
failed_when: result.failed or not result.changed
- name: ensure map TestMap has an empty description, again
ipaautomountmap:
ipaadmin_password: SomeADMINpassword
name: TestMap
location: TestLocation
desc: ""
register: result
failed_when: result.failed or result.changed
- name: ensure map TestMap is removed
ipaautomountmap:
ipaadmin_password: SomeADMINpassword