backup: Fix bug in adding existing unencryped backup location

borg throws and warning "Warning: Attempting to access a previously unknown
unencryped repository!\nDo you want to continue?" and then fails while asking
for a manual confirmation. Avoid this by telling borg not to prompt (and confirm
yes).

This commit provides a fix for the issue described here:

https://discuss.freedombox.org/t/how-do-i-restore-freedombox/2022/10

[sunil: Drop the part about handling the error message]
Signed-off-by: Benedek Nagy <contact@nbenedek.me>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
Benedek Nagy 2023-09-30 16:17:51 +02:00 committed by Sunil Mohan Adapa
parent 9cfd8a2e55
commit 8bafabe2f9
No known key found for this signature in database
GPG Key ID: 43EA1CFF0AA7C5F2

View File

@ -339,6 +339,7 @@ def load_settings(app_id: str) -> dict[str, int | float | bool | str]:
def _get_env(encryption_passphrase: str | None = None):
"""Create encryption and ssh kwargs out of given arguments."""
env = dict(os.environ, BORG_RELOCATED_REPO_ACCESS_IS_OK='yes',
BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK='yes',
LANG='C.UTF-8')
# Always provide BORG_PASSPHRASE (also if empty) so borg does not get stuck
# while asking for a passphrase.