-
Notifications
You must be signed in to change notification settings - Fork 243
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
Appending to a file is not idempotent #642
Comments
Neat, I didn't know about https://httpbin.org/. There's a potential optimization we could do on OSTree-based systems for files in I'll just also mention that making append operations idempotent is also relevant for other software that handle Ignition configs like the machine config daemon (though right now it just sorta assumes that it won't be handed a config that asks for appending files). |
It's inherently non-idempotent. See upstream Ignition issue on this: coreos/ignition#642
@bgilbert The proposed fix would help, but wouldn't completely fix the problem. If something fails during or after deleting the @jlebon we'd need to bake the logic into ignition to append from |
The assumption was that nothing would fail after the commit point. The approach isn't bulletproof, but would at least address Ignition config problems and transient network conditions. I agree that the ostree-specific logic doesn't seem worth it. |
Bug
Operating System Version
Any
Ignition Version
0.28.0
Environment
Any
Expected Behavior
If
storage.files[].append
istrue
, thecontents
are appended exactly once.Actual Behavior
In the presence of failures, the
contents
can be appended multiple times.Reproduction Steps
On Container Linux:
Other Information
On Container Linux, if Ignition fails, the machine will automatically reboot after 5 minutes and Ignition will rerun. With the above config, fetching
/bar
will fail 75% of the time but will eventually succeed, at which point/foo
will contain one line per attempt.We can fix this by appending to files in two passes:
file.ignition-orig
exists. If so, overwritefile
withfile.ignition-orig
before appending tofile
. If not, copyfile
tofile.ignition-orig
..ignition-orig
files.That approach appropriates
*.ignition-orig
as private namespace for Ignition. One alternative is to create an.ignition-temp
directory at the root of the filesystem and put the backup files there.The text was updated successfully, but these errors were encountered: