-
-
Notifications
You must be signed in to change notification settings - Fork 50
Added configuration support for additional restic commands #94
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
Added configuration support for additional restic commands #94
Conversation
Codecov Report
@@ Coverage Diff @@
## master #94 +/- ##
==========================================
+ Coverage 64.62% 64.95% +0.33%
==========================================
Files 64 64
Lines 6371 6414 +43
==========================================
+ Hits 4117 4166 +49
+ Misses 2050 2047 -3
+ Partials 204 201 -3
Continue to review full report at Codecov.
|
e1da1e5
to
4e6b3ff
Compare
You might notice, I've removed several unnecessary nil checks to reduce the overall complexity of |
Yes, I like the refactoring of the tests 👍🏻 There's something I can't figure out... In the current version, when I select a backup path of |
My bad. This PR translates all paths (including parameter |
Indeed, also I found another bug: if you select a glob in the backup source it's not resolved when passed as a Sorry 😊 |
Thanks! Looks like |
Sorry, there's something else I just noticed: if you use a relative path in the backup source, it needs to be translated into an absolute path in the restic is expanding the paths during the backup and writing down the absolute path in the snapshot definition. Then if you run a command selecting these paths (like |
So the prev implementation to resolve I kind of thought that it is like this but wasn’t sure if Wondering how to fix this, Log warning when |
Glob pattern in a backup source are another issue. They also let Guess the best that can be done is reviewing what restic can support exactly for path filters and log a warning whenever a specified filter depends on the local environment instead of paths from the repository. |
It is a bit of a difficult one indeed. Although I'm not sure if restic is actually doing much about it: |
Wanted to check it as well, though I assume for the moment If that is true, the most reasonable fix would be to resolve the path but warn when resolving changes the user input. Resolving in this case means, resolve copied backup sources like backup sources and make them absolute. For custom path values make them absolute only. Depending on what restic really supports the warning log can be designed to contain more info how to prevent the warning by adjusting the path filter. Will update the PR when I know more. |
Sorry I made a change on the master branch to fix an issue with the |
3c9e251
to
707cc0a
Compare
No problem, rebase and merge was no issue. Btw. I've had time to check So I'll go ahead and resolve the paths like described earlier and whenever this changes the path, I'll log a warning that the path match might not be stable and tags or custom paths should be used. |
Update is almost ready but needs more tests. |
707cc0a
to
68d0360
Compare
.. I know it became quite a change but it makes future adjustments easier as new things have to be added at less places. The latest update prints the following when "path" is not absolute:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, I tried it and it works perfectly with my test profiles.
I also noticed your DefinedCommands()
improvement with reflection, thanks (speaking of which, go 1.18 is out, exciting!).
I think it's ready to go whenever you're happy with it
Also implements tag and path copy with boolean for all commands Copies backup tags to retention for version 2 configs Translates path to absolute and displays that config should be fixed
68d0360
to
1d2b214
Compare
Kudos, SonarCloud Quality Gate passed!
|
Looks good to me 👍🏻 |
Merged 😀 |
This PR is a cherry-pick from #66 to support configuration of additional commands that manage snapshots (or restore files).
Support for the following additional commands is added:
dump
,find
,ls
,restore
,stats
,tag
. All of the commands optionally have host, path and tag filters which can now be set in the profile.In detail, this PR adds the following:
tag
andpath
copy frombackup
with booleantrue
for all commandsSetHost
for thecopy
sectionpath
andtag
forretention
in config file version 2. Both parameters are copied frombackup
when not explicitly defined. Was mentioned in Optional: Allow disabling path in retention with 'false' #67 that it would be better to have the same defaults for both filters but couldn't be implemented to not break existing configs.