-
Notifications
You must be signed in to change notification settings - Fork 187
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-12511: Now cf-net get
no longer unlinks original file
#5666
Conversation
The command `cf-net get <FILENAME>` now writes to `<FILENAME>.cfnew` followed by replacing `<FILENAME>` with `<FILENAME>.cfnew`. Previously it would unlink and re-create the original file. With the new `"filestream"` protocol, we need the original file in order to compute its signature, so that we can save bandwidth using the RSYNC protocol. Furthermore, unlinking the original file, causes a brief moment when it either does not exist or is incomplete. This can be problematic if other processes depend on it. Ticket: ENT-12511 Changelog: Title Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
@cf-bottom Jenkins please :) |
Sure, I triggered a build: Jenkins: https://ci.cfengine.com/job/pr-pipeline/11534/ Packages: http://buildcache.cfengine.com/packages/testing-pr/jenkins-pr-pipeline-11534/ |
The File Stream API now unlinks the destination file (i.e., `<FILENAME>.cfnew`) before opening it with the `O_EXCL` flag. Previously the agent would fail if the destination file already exists. Fortunately, the File Stream API unlinks this file afterwards, both on success and error, causing the agent to recover. Both the `cf-net get <FILENAME>` command and the `copy_from` attribute were affected. Ticket: None Changelog: Commit Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
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 either way.
} | ||
|
||
if (!success) | ||
{ | ||
unlink(local_path); | ||
Log(LOG_LEVEL_VERBOSE, "Removing file '%s'...", dest); |
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.
These should be INFO
, I think. The rule of thumb is that info:
message inform the user about changes being made. (applies below as well)
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.
Not according to @olehermanse (see CFE-4470).
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.
I have no problem with that. Let's just be consistent.
The command
cf-net get <FILENAME>
now writes to<FILENAME>.cfnew
followed by replacing
<FILENAME>
with<FILENAME>.cfnew
. Previouslyit would unlink and re-create the original file.
With the new
"filestream"
protocol, we need the original file in orderto compute its signature, so that we can save bandwidth using the RSYNC
protocol. Furthermore, unlinking the original file, causes a brief
moment when it either does not exist or is incomplete. This can be
problematic if other processes depend on it.
Ticket: ENT-12511
Changelog: Title
Signed-off-by: Lars Erik Wik lars.erik.wik@northern.tech
together with NorthernTechHQ/libntech#231