-
Notifications
You must be signed in to change notification settings - Fork 153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mount.py no rmdir when state=='absent' #569
base: main
Are you sure you want to change the base?
Conversation
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.
Build succeeded. ✔️ ansible-galaxy-importer SUCCESS in 2m 53s |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the PR! :)
I have left a comment as a change request.
@@ -899,11 +899,6 @@ def main(): | |||
module.fail_json( | |||
msg="Error unmounting %s: %s" % (name, msg)) | |||
|
|||
if os.path.exists(name): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will change the behavior of state: absent
.
But I don't think the rmdir
logic should be skipped. Because it breaks backward compatibility.
If you want to skip it, how about adding keep_mountpoint
or preserve_mountpoint
to keep the mountpoint to avoid Directory not empty
error instead of removing this section.
If this is set as true
, you can skip rmdir
section. Also, if the default value is set as false
, to keep backward compatibility, you can set it to false
by default.
new option keep_mountpoint enables keeping the mountpoint with state=absent
Build succeeded. ✔️ ansible-galaxy-importer SUCCESS in 4m 41s |
suppressed erroneous remaining TOTO check
Build succeeded. ✔️ ansible-galaxy-importer SUCCESS in 2m 49s |
delete trailing spaces in comments in mount.py
Build succeeded. ✔️ ansible-galaxy-importer SUCCESS in 3m 29s |
still a trailing whitespace
Build succeeded. ✔️ ansible-galaxy-importer SUCCESS in 4m 17s |
@saito-hideki |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @YvesMP
Thanks for the update.
Your changes worked without any issues in my lab. If you address the following three things, we can merge this PR.
- Please create a changelog fragment file according to the following docs:
- Could you append some integration tests for keep_mountpoint?
- Could you append some examples?
remove empty lines and vim comment
Build succeeded. ✔️ ansible-galaxy-importer SUCCESS in 2m 48s |
deleted trailing newlines
Build succeeded. ✔️ ansible-galaxy-importer SUCCESS in 3m 10s |
escape :
Build succeeded. ✔️ ansible-galaxy-importer SUCCESS in 2m 54s |
SUMMARY
remove rmdir done after umounting when the requested state is 'absent'
ISSUE TYPE
COMPONENT NAME
mount.py
ADDITIONAL INFORMATION
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.