-
Notifications
You must be signed in to change notification settings - Fork 451
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
[node-agent] Delete leftover *.tmp
files from failed copy attempts
#9630
[node-agent] Delete leftover *.tmp
files from failed copy attempts
#9630
Conversation
@oliver-goetz: GitHub didn't allow me to request PR reviews from the following users: MichaelEischer. Note that only gardener members and repo collaborators can review this PR, and authors cannot review their own PRs. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@@ -141,6 +141,14 @@ func Move(fs afero.Afero, source, destination string) error { | |||
func moveCrossDevice(fs afero.Afero, source, destination string) error { | |||
tmpFilePath := destination + ".tmp" | |||
|
|||
if tmpFile, err := fs.Stat(tmpFilePath); err == nil && tmpFile.Mode().IsRegular() { |
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.
Quick question - is it ok if we only do this removal in the moveCrossDevice
function as copyAndSync
is also called from Copy
?
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.
Copy
uses a temporary directory as destination (ref) which is deleted afterwards.
However, it is now removed with RemoveAll
. Otherwise, it cannot be deleted if it is not empty e.g. when the file cannot be moved its the real destination.
/lgtm Thanks for the cleanup. |
@MichaelEischer: changing LGTM is restricted to collaborators In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
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
LGTM label has been added. Git tree hash: a104eb4013391395c469aeb6cd8445a6c9bbdae2
|
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: plkokanov The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
How to categorize this PR?
/area robustness
/kind enhancement
What this PR does / why we need it:
This is a follow up to PR to #9609.
If a previous file copy attempt failed
gardener-node-agent
now deletes leftover*.tmp
files instead of returning an error.Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
/cc @rfranzke @MichaelEischer
I did not introduce a special handling for symlinks at the the
destination
.copyAndSync
copies into new files only.In
Copy
andMove
the final step is alwaysfs.Rename(xyz, destination)
. If there is a symlink it will be overwritten with a file. GNA does not create symlinks. Thus, if there is one it was created by someone else. We don't check for files created by someone else either, so we can do the same for symlinks.Release note: