Update the logic that probes for the borgmatic streaming database dump, bootstrap metadata, and check state directories (#934). #937
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "update-runtime-directory-logic"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This is an implementation of #934. More specifically, these are the changes:
/tmp
for the runtime (database dump + bootstrap metadata) directory.See #934 for details.
Implementation notes
The broad strokes changes here are:
/tmp
gets created as part of this, borgmatic needs to actually delete it before exiting! So the context manager makes the cleanup step easier and more assured to happen.borgmatic_runtime_directory
to various code that needs it, since we can no longer calculate it on the fly wherever it's needed (due to the aforementioned temporary subdirectory thing).STATE_DIRECTORY
to one of the probed-for environment variables for the state directory in particular. (This is distinct from the runtime directory.) That way the systemdStateDirectory=
option can be used to set borgmatic's state directory from a systemd service.Still to do
My Python isn't good enough to give this a proper review but thumbs up for supporting
STATE_DIRECTORY
. I didn't think to make a fuss about it but strictly speaking system service state should be under/var/lib
like this makes it. Thanks for your work.Sure thing! And thanks for commenting.. I'm glad to hear
STATE_DIRECTORY
would be useful. If you do want to review something that doesn't require a degree in Python, you can have a gander at the docs changes and make sure at least the documented logic (if not the actual code it's documenting) looks right:The text itself LGTM but I have some unrelated comments.
It doesn't seem to be documented anywhere that borgmatic uses the runtime dir to place the bootstrap manifest into the archive and not just for the database backup feature. This means the runtime dir must be available and writable even if database backups aren't used.
Semi-relatedly it seems borgmatic will write to the state dir even if the check frequency feature isn't used. This may also be worth documenting or changing.
Both are nits because with
StateDirectory
andRuntimeDirectory
now configured systemd will make sure these exist and are writable but problems with the runtime dir not being writable is how I ended up filing #934.Edit: Perhaps consider documenting all files/dirs borgmatic uses like how borg does. (See "directories and files".)
Good point! It's now documented, such as it is, here:
57decfa4db
At some point, the docs could probably use some reorganization to factor more stuff out into reference docs.
There is a (documented) case where
frequency
isn't specified but borgmatic still applies a default frequency, which is when no checks are declared at all. But one approach might be to skip writing the check time to the state directory when it's not specified for that check. Filed here: #938.I'll defer that to any forthcoming reference docs refactoring. (Which I probably need to file.)
Thanks for pointing out these issues!
WIP: Update the logic that probes for the borgmatic streaming database dump, bootstrap metadata, and check state directories (#934).to Update the logic that probes for the borgmatic streaming database dump, bootstrap metadata, and check state directories (#934).#942.