-
Notifications
You must be signed in to change notification settings - Fork 186
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
ENT-11988: Atomic copy_from in files promise #5611
Conversation
b83a9fd
to
03481d9
Compare
@cf-bottom Jenkins please :) |
Sure, I triggered a build: Jenkins: https://ci.cfengine.com/job/pr-pipeline/11253/ Packages: http://buildcache.cfengine.com/packages/testing-pr/jenkins-pr-pipeline-11253/ |
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.
Looks good to me except that we should use (the code from) CopyRegularFileDisk()
, I believe.
Changes to `files` promise in `copy_from` attribute: - The new file (i.e., `<FILENAME>.cfnew`) is now created with correct permission during remote copy. Previously it would be created with default permissions. - The destination file (i.e., `<FILENAME>`) is no longer deleted on backup during file copy. Previously it would be renamed to `<FILENAME>.cfsaved`, causing the original file to dissappear. Now an actual copy of the original file with the same permissions is created instead. As a result, there will no longer be a brief moment where the original file is inaccessible. Ticket: ENT-11988 Changelog: Commit Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
Thanks 🍻 |
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.
Yeah, makes sense. I had to go looking for the "move cfnew to dest" code and found it at
if (rename(changes_new, changes_dest) == 0)
{
RecordChange(ctx, pp, attr, "Moved '%s' to '%s'", new, dest);
*result = PromiseResultUpdate(*result, PROMISE_RESULT_CHANGE);
}
Interesting that the RecordChange() call uses different variables than the rename() call but they "should" be the same. ;)
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.
ACK
Changes to
files
promise incopy_from
attribute:<FILENAME>.cfnew
) is now created with correctpermission during remote copy. Previously it would be created with
default permissions.
<FILENAME>
) is no longer deleted onbackup during file copy. Previously it would be renamed to
<FILENAME>.cfsaved
, causing the original file to dissappear. Now anactual copy of the original file with the same permissions is created
instead.
As a result, there will no longer be a brief moment where the original
file is inaccessible.
Back-ported to: