configFile: directly write changes to configFile#2902
Conversation
338cd9f to
5e71de4
Compare
Codecov Report
@@ Coverage Diff @@
## master #2902 +/- ##
==========================================
- Coverage 57.05% 57.05% -0.01%
==========================================
Files 297 296 -1
Lines 18653 18631 -22
==========================================
- Hits 10643 10630 -13
+ Misses 7151 7146 -5
+ Partials 859 855 -4 |
thaJeztah
left a comment
There was a problem hiding this comment.
Hmmm... not sure about this change. The temp-file was added for a reason, and to make sure that writes would be preformed atomically (see #1359). Removing this would mean we introduce that problem again.
What other process is using the file in your case that prevents it from being accessed?
@thaJeztah The file is volumed to a container and It can't be removed so moving another file to this file will be failed. For example, mount |
5e71de4 to
790a385
Compare
@thaJeztah I used |
In some situations, the config.json is volumed from somewhere else and the file is busy, move can't be performed on this file and configFile.Save() will be failed because it's trying to move another file to this file. This will write changes directly to the file. For concurrency issues, it will lock the file using flock and release after write. Signed-off-by: Seena Fallah <seenafallah@gmail.com>
790a385 to
6a89348
Compare
In some situations, the config.json is volumed from somewhere else and the file is busy, move can't be performed on this file and configFile.Save() will be failed because it's trying to move another file to this file. This will write changes directly to the file.
Signed-off-by: Seena Fallah seenafallah@gmail.com
- What I did
Write config file changes directly to the file.
- How to verify it
Volume docker config in a
slavemode and try to change it withdocker logininside the container- Description for the changelog
Perform config file changes even if the file is busy
- A picture of a cute animal (not mandatory but encouraged)
