"borgmatic restore --database all" should error when not actually restoring anything
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 TAM-verified manifest 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 root/tmp root/tmp/log root/tmp/test.yaml root/.borgmatic root/.borgmatic/postgresql_databases root/.borgmatic/postgresql_databases/database.example.org root/.borgmatic/postgresql_databases/database.example.org/users root/.borgmatic/postgresql_databases/localhost root/.borgmatic/postgresql_databases/localhost/test root/.borgmatic/mysql_databases root/.borgmatic/mysql_databases/172.17.0.2 root/.borgmatic/mysql_databases/172.17.0.2/all terminating with success status, rc 0 summary: 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.
Deleting a branch is permanent. It CANNOT be undone. Continue?