borgmatic restore does not pass options from mongodb hook #533
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#533
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 want to backup and restore my mongodb database via borgmatic hooks
Steps to reproduce (if a bug)
The database needs the
--ssl
option set for the connection to workActual behavior (if a bug)
This works fine by setting the options via the config for creating the backup
But for
borgmatic restore --archive latest
I get:With
error connecting to host: could not connect to server: server selection error
in the descriptionExpected behavior (if a bug)
I think the reason for this is that the --ssl flag is missing on the
mongorestore
command and therefore it fails.So the options should be added to the restore command as well
Environment
borgmatic version: [version here]
1.6.0
borgmatic installation method: [e.g., Debian package, Docker container, etc.]
pip
Borg version: [version here]
borg 1.1.16
Python version: [version here]
Python 3.10.4
Database version (if applicable): [version here]
mongodb 4.2
operating system and version: [OS here]
Debian bullseye
Thank you for reporting this! It looks like this behavior is intentional—all the database hooks only pass the database
options
value to the dump and not the restore commands. I think the idea is that users often want to provide dump-only options.Given that you're interested in passing the
--ssl
flag, which seems like a pretty common need, what do you think of borgmatic supporting a newssl
option (true or false) along with your other MongoDB database options? When true, that could plumb the--ssl
flag to both dump and restore commands.Hey thank you for the quick response.
Yes adding an ssl option would sound good to me.
Maybe this could also be solved with a mongodb connection string. But if so I could not figure this out yet…
Maybe another idea would be to have
restore_options
that work the same asoptions
but for the restore command? This way more complex (connection) setups would also be supported.Both of those approaches (
ssl
andrestore_options
) sound good to me! There is already precedent in some of the other database hooks for things likelist_options
.The MongoDB hook now has a
restore_options
configuration option in borgmatic 1.7.6. Enjoy!