"borgmatic restore --database all" should error when not actually restoring anything #246
What I'm trying to do and why
I'm trying to restore databases when I don't actually have any databases configured in borgmatic's configuration. A user might do this accidentally, not realizing that the restore they think is happening (because no error) is actually not restoring anything. Unless they look carefully at the output, they may not realize nothing happened.
Steps to reproduce (if a bug)
# borgmatic restore -c test.yaml -v 2 --archive flux-2019-11-12T16:06:29.673759 --database all
No databases configured in
test.yaml. Some database dumps in the archive.
Actual behavior (if a bug)
Ensuring legacy configuration is upgraded
test.borg: Restoring databases from archive flux-2019-11-12T16:06:29.673759
borg extract --debug --list --show-rc /root/tmp/test.borg::flux-2019-11-12T16:06:29.673759
using builtin fallback logging configuration
35 self tests completed in 0.07 seconds
Verified integrity of /root/tmp/test.borg/index.699
security: read previous location '/root/tmp/test.borg'
security: read manifest timestamp '2019-11-13T00:06:29.827230'
security: determined newest manifest timestamp as 2019-11-13T00:06:29.827230
security: repository checks ok, allowing access
terminating with success status, rc 0
test.yaml: Successfully ran configuration file
Expected behavior (if a bug)
Other notes / implementation ideas
Would also be good to check what happens when databases are configured, but none are found in the archive.
borgmatic version: 1.4.10.dev0
borgmatic installation method:
pip install --editable
Borg version: 1.1.10
Python version: 3.7.4
Database version (if applicable): PostgreSQL 11.5, MySQL Ver 15.1 Distrib 10.4.8-MariaDB
operating system and version: Manjaro stable
Potential data loss: This is a particularly nasty bug. What happened is that when no databases are configured, no dump patterns get passed to
borg extract, which means borg extracts all files in the archive instead of just database dumps, which means it could extract over your actual non-database files! Super not good. I have a fix in hand, and will release it shortly.
Fix released in borg 1.4.10. Upgrading is highly recommended!
No due date set.
No dependencies set.
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?