-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
fix: os.Remove should ignore non existing errors #4502
fix: os.Remove should ignore non existing errors #4502
Conversation
…s os.IsNotExist errors
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.
LGTM
@lukemassa any comments? ( since you have been looking at this code recently) |
This should at least log a warning within the original functions (not the new utils function), rather than failing silently. |
@X-Guardian Happy to add it, but curious why it should log it. The desired outcome of calling
Neither of them is a failure or undesired behavior, and you achieved the desired end state of |
To cover scenario 3, where there is a bug in Atlantis and the filename/path has not been built correctly so that is why the delete failed. |
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.
💯
Straight forward change. Thank you @jippi
The warning is a good idea. I want to avoid a philosophy of blocking fixes for the sake of perfection. I would like to see a follow-up PR for the warning, as recommended. |
what
We've seen cases where
atlantis unlock
fails, and when inspecting the error from logs, we found that it was caused by Atlantis trying to remove a plan file that does not exist.This change treats the
os.NotExists
error as a "success" when removing a file (since the outcome is the same, the file should not be there).We've seen this in production a few times, but most notably when doing ephemeral testing.
why
Removing a file should not fail if the file does not exist.