librarian-puppet
librarian-puppet copied to clipboard
librarian-puppet install with destructive mode doesn't make atomic changes
Currently, librarian-puppet install
when used with the destructive mode does not use an atomic action when replacing the install_path
. As seen in the install action0, it starts by removing everything and creating a new empty directory and then recreates all of the modules.
This means that during the whole time that librarian-puppet is recreating all of the module directories, lots of things are missing! If one is using librarian-puppet on the puppetmaster, this can impact puppet clients that start their run during this period: some modules are missing entirely, causing errors, and in some more dire cases some things can end up being modified on the client because of the missing bits.
I think librarian-puppet can do a bit better. one method would be to create a temporary directory right beside the install_path
, place all of the files in that temp dir, and then once everything is done and no errors happened, rename the current install_path
to take it out of the way, and rename the temp dir as the new install_path
. This renaming operation would make the change atomic. once the rename is done, the install action could remove the tmp dir.