mirror of
https://github.com/ansible-collections/ansible.posix.git
synced 2026-01-11 15:15:26 +01:00
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.
This commit is contained in:
parent
7e4d5dd7a9
commit
5ee818ec86
1 changed files with 0 additions and 5 deletions
|
|
@ -899,11 +899,6 @@ def main():
|
||||||
module.fail_json(
|
module.fail_json(
|
||||||
msg="Error unmounting %s: %s" % (name, msg))
|
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':
|
elif state == 'unmounted':
|
||||||
if ismount(name) or is_bind_mounted(module, linux_mounts, name):
|
if ismount(name) or is_bind_mounted(module, linux_mounts, name):
|
||||||
if not module.check_mode:
|
if not module.check_mode:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue