diff --git a/plugins/modules/ipaautomountmap.py b/plugins/modules/ipaautomountmap.py index 79b341b9..9cca0a98 100644 --- a/plugins/modules/ipaautomountmap.py +++ b/plugins/modules/ipaautomountmap.py @@ -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 diff --git a/tests/automount/test_automountmap.yml b/tests/automount/test_automountmap.yml index da542e89..377b3a82 100644 --- a/tests/automount/test_automountmap.yml +++ b/tests/automount/test_automountmap.yml @@ -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