file:// paths for repositories #576
Labels
No Label
bug
data loss
design finalized
good first issue
new feature area
question / support
security
waiting for response
No Milestone
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: borgmatic-collective/borgmatic#576
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
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?
What I'm trying to do and why
Borg supports
file://
style paths for repositories, but borgmatic currently doesn't. That's because borgmatic assumes if a:
character occurs in a repository path, it must be a remote repository. When borgmatic thinks a repository is remote, it:ssh://
repository.Why add support for this: Given that Borg supports these paths, and given that Borg 2 is moving to only
ssh://
-style paths for remote repositories, users may have the expectation thatfile://
-style paths will work as well. Additionally, the current failure mode when they're used is pretty obnoxious / non-obvious.Other notes / implementation ideas
Effected files:
config/validate.py
,config/normalize.py
,borg/extract.py
,export_tar.py
.It would be nice if, as part of this work, all of this logic could be moved into one place so it's not scattered across several source files. Maybe it could be part of the existing normalization step.
file:// paths in repositoriesto file:// paths for repositoriesConverting the
file://
paths to absolute paths that Borgmatic currently uses in thevalidate.py
andnormalize.py
files should be enough right?Other than this do only
extract.py
andexport_tar.py
use the actual repository path from the configuration? Specifically these lines :If so, I can take a look at this.
Thanks for taking a look!
That sounds like a totally reasonable approach. One thing you'll need to account for though is that if the user has
file:///foo/bar
inrepositories
in their configuration file and types--repository file:///foo/bar
on the command-line to select that repository, it should ideally still match.Besides those two, the other borgmatic actions don't look at the repository path directly, but they call functions that do. (And they do pass the repository path to Borg.) For instance, several of the actions in
borgmatic/actions/*.py
callborgmatic.config.validate.repositories_match()
which callsnormalize_repository_path()
which does the':'
repository path introspection trick.This should be taken care of in
borgmatic.py::run_actions()
right?and for
I would have already edited that function when handling this conversion for config files, so the 4 files you mentioned above and
borgmatic.py
will be the only files I'll touch.Just making sure I don't miss anything.
Are you asking if the start of
run_actions()
is where the two repository paths should be matched? Or where they should be normalized? Because I think the matching should occur inborgmatic/config/validate.py:repositories_match()
and normalization should happen inborgmatic/config/normalize.py:normalize()
. Or am I misunderstanding?That sounds right.
I wanted to ask if
--repository file:///foo/bar
be changed to--repository /foo/bar
inborgmatic.py::run_actions()
(internally changing the param)?Or will this be automatically handled after I make changes to the other files?
Ah, gotcha. The
repository_path
inrun_actions()
comes from a borgmatic configuration file originally, so at that point it would presumably already be changed to a non-file://
path (after the changes you make to the other files).However, that doesn't handle the
--repository file:///foo/bar
case! That's because that repository path is part of each action's arguments. But if you rewrite the command-line repository path as part ofborgmatic/config/validate.py:repositories_match()
(or alternatively, in each function that calls it), that would take care of the--repository
flag.Implemented by @diivi: https://github.com/borgmatic-collective/borgmatic/pull/54
Released in borgmatic 1.7.10!