Read BORG_RELOCATED_REPO_ACCESS_IS_OK environment variable #707
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#707
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
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
Running borg check or borg check --repair to a repository that has been moved location recently.
Steps to reproduce (if a bug)
docker run
-d
--name='borgmatic'
--net='bridge'
-e TZ="America/Los_Angeles"
-e HOST_CONTAINERNAME="borgmatic"
-e 'TZ'='America/Los_Angeles'
-e 'BORG_RELOCATED_REPO_ACCESS_IS_OK'='yes'
Actual behavior (if a bug)
/mnt/borg-repository/borg_backup/repo1: Listing archives
Warning: The repository at location /mnt/borg-repository/borg_backup/repo1 was previously located at /mnt/borg-repository/repo1
Do you want to continue? [yN] no (from BORG_RELOCATED_REPO_ACCESS_IS_OK)
Aborting.
Repository access aborted
Expected behavior (if a bug)
/ # borg list /mnt/borg-repository/borg_backup/repo1
Enter passphrase for key /mnt/borg-repository/borg_backup/repo1:
Warning: The repository at location /mnt/borg-repository/borg_backup/repo1 was previously located at /mnt/borg-repository/repo1
Do you want to continue? [yN] yes (from BORG_RELOCATED_REPO_ACCESS_IS_OK)
repo1-2022-11-30T18:15:00 Wed, 2022-11-30 18:15:27
repo1-2022-12-31T18:15:00 Sat, 2022-12-31 18:15:14
repo1-2023-01-31T18:15:01 Tue, 2023-01-31 18:15:15
Other notes / implementation ideas
When running borgmatic check, borgmatic is not able to read the BORG_RELOCATED_REPO_ACCESS_IS_OK environment and automatically type "no" for me, however borg does read and execute it properly.
I think there has to be a way for borgmatic to read that environment the same way as borg is able to do so.
I tested this with borgmatic 1.7.9 and 1.7.13; borg 1.2.3 and 1.2.4 both are able to detect 'BORG_RELOCATED_REPO_ACCESS_IS_OK'='yes' properly.
To know more about it: https://github.com/borgbackup/borg/issues/1426#issuecomment-236919222
Environment
borgmatic version: [1.7.13]
borgmatic installation method: [Docker container]
Borg version: [1.2.4]
Python version: [3.11.2]
I've not used the docker image, but for what it's worth there's an option for this in the borgmatic configuration file
You can probably override the configuration in the command line invocation instead for a one-off: https://torsion.org/borgmatic/docs/how-to/make-per-application-backups/#configuration-overrides
Thanks for filing this! Seems like a reasonable feature request. But yeah, you can use the existing configuration option in the meantime as @s1shed points out.
borgmatic is not able to read some of borg optionsto Read BORG_RELOCATED_REPO_ACCESS_IS_OK environment variableFor anyone looking to implement this: I'd recommend keeping the existing configuration option, but then if the
BORG_RELOCATED_REPO_ACCESS_IS_OK
environment variable is set, use that to override that config option. There's also the separateBORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK
environment variable /unknown_unencrypted_repo_access_is_ok
config option, which would be nice to roll into this work.The changes in question would likely go into
borgmatic/borg/environment.py:make_environment()
.So I just checked this with the most recent borgmatic release, and setting the BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK environment variable does cause borgmatic to pass that variable through to Borg as long as the
relocated_repo_access_is_ok
option isn't set in borgmatic's configuration file. If therelocated_repo_access_is_ok
option is set, then that overrides the environment variable. That actually seems like the right precedence to me, so I'm going to call this "done" for now. But if you have other feedback and/or have issues getting this working, please do let me know.