diff --git a/plugins/modules/ipaautomountmap.py b/plugins/modules/ipaautomountmap.py index 79b341b99dcb43c4e41a695bee7f0928858ceb13..9cca0a9852fa98be8aa4553752f5ea995df8a47e 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 da542e89cb6a0cc16dde859c3811b4cfdbf85633..377b3a8270405d231345fdd451626f768bfc3338 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