How to prevent repeating output of the same by list, info, ... commands #479
Labels
No Label
bug
data loss
design finalized
good first issue
new feature area
question / support
security
waiting for response
No Milestone
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: borgmatic-collective/borgmatic#479
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
I am curious how to prevent the same output several times if I use list, info, ... in case multiple configurations available for same repository. My configuration follows the manual to get a per-application backup.
My setup:
/etc/borgmatic.d
and one global/etc/borgmatic
).borgmatic create ...
creates for each config a separate archive (with different pattern/name) as expected in same repositoryborgmatic list
list all archives in this repository but repeats the list in my case three times with same contentWhat did I miss to prevent the repeated output?
Other notes / implementation ideas
Environment
borgmatic version: 1.5.20
borgmatic installation method: dnf (rpm)
Borg version: 1.1.17
Python version: 3.10.0
Database version (if applicable): none
operating system and version: Linux 5.14.18-300.fc35.x86_64
I have a similar set-up, with multiple config files for each individual application.
I list the archives for a specific application by providing the config file used for that application.
It list all archives in the repository once. But I would expected in this case only the archives of this configured application. I configured different archive names, so I have to use additionally a pattern with
-P
.Sure it can be done in this way, but it isn't practical. Because I have to know each configuration details.
I would propose the following logic:
borgmatic list
(without any parameter) display all archives of the repository but only once per repository orSimilar logic in case of
info
command.Starting to experience more details about my setup,
diff
do the same repeatings, which makes no sense. Diff compare two archives related to a specific repository. If I don't define a configuration file I get the same result several times (as much configs as I have).What does it mean in detail to specify a configuration file? I would expect the command is related to the configuration, but the command is working whatever configuration I specify. But if I use a per-application file, the command is maybe not working, because not all details are set.
Side note: Currently the whole setup (in my environment) is working, because it seems to merge the global configuration
/etc/borgmatic
with per-application config from/etc/borgmatic.d
. I have specified not all parameter in all. For example the parameterencryption_passcommand
is only defined in global config. But it is used (automatically without include) for all configurations during a backup run.Maybe it is a bug, but it is a good one for me;-). Because it makes it easier to define seperated configs, without forgetting basic stuff respectively to force config parameter globally. An include statement can be forgotten...
Otherwise if I use a different repo location in one config file, I have to use the right one in case to call
diff
for example.Just my 50 cents. Hope I could made my thoughts clear and I am open for discussion...
I apologize for the delay in getting to this. This does sound to me like an obnoxious "feature" of using the same repository in multiple borgmatic configuration files, and I agree that it's something borgmatic should address.
The tricky part here is that each configuration file, even if it contains the exact same repository, has different options that can affect the repository listing/info. For instance if each configuration file has a different
local_path
orremote_path
orlock_wait
, it's not immediately clear which values to use when listing a de-duplicated repository. So that's why borgmatic currently executeslist
,info
, and other actions within the context of a single configuration file at a time.That sounds reasonable, but this is also a little tricky! The
archive_name_format
can be arbitrary complex, and so currently it's up to the user to define aconsistency
and/orretention
prefix
that matches the archive names resulting from the configured format.So do you think it would solve your use case if there was another
prefix
(orglob_archives
/match_archives
) option that you could configure in each configuration file to influence how borgmatic ranlist
orinfo
for the repository in that file? The main downside is it would be up to you to configure it.An alternative would be for borgmatic to automatically try to parse
archive_name_format
and construct a glob pattern that matches archives named with it. But without some experimentation, I'm not 100% sure such an approach would work. The upside is that the user wouldn't have to go configuring prefixes or other options.I believe this was a bug that (unfortunately) has since been fixed (#555)!
Please let me know your thoughts when you get a chance.
At long last, this is implemented in master and will be part of the next release. Rather than doubling down on
prefix
, I went with this approach:Here's an example of it in use:
The documentation on this feature is here: https://torsion.org/borgmatic/docs/how-to/make-per-application-backups/#archive-naming
Thanks for filing this ticket to being with!
Also see #588, which is related and will probably be implemented as a way to override the feature in this ticket (#479).