From 5ee818ec86771b8523517d0f990094fdf2424601 Mon Sep 17 00:00:00 2001 From: Yves MOYROUD <41052194+YvesMP@users.noreply.github.com> Date: Wed, 18 Sep 2024 17:41:21 +0200 Subject: [PATCH] Update mount.py In function main(), remove rmdir in case if state == 'absent'. Unmounting a file system should not lead to delete anything that is revealed after unmounting. Also, it leads to an error if a non empty directory is present under the ex-mountpoint after umount : [Errno 39] Directory not empty So umount is successfull but the ansible run is failed. Of course, it is solved on second run. --- plugins/modules/mount.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/plugins/modules/mount.py b/plugins/modules/mount.py index fe9faff..7bc897b 100644 --- a/plugins/modules/mount.py +++ b/plugins/modules/mount.py @@ -899,11 +899,6 @@ def main(): module.fail_json( msg="Error unmounting %s: %s" % (name, msg)) - if os.path.exists(name): - try: - os.rmdir(name) - except (OSError, IOError) as e: - module.fail_json(msg="Error rmdir %s: %s" % (name, to_native(e))) elif state == 'unmounted': if ismount(name) or is_bind_mounted(module, linux_mounts, name): if not module.check_mode: