diff --git a/borgmatic/borg/environment.py b/borgmatic/borg/environment.py index 1b14369a..ee438955 100644 --- a/borgmatic/borg/environment.py +++ b/borgmatic/borg/environment.py @@ -14,6 +14,7 @@ OPTION_TO_ENVIRONMENT_VARIABLE = { DEFAULT_BOOL_OPTION_TO_ENVIRONMENT_VARIABLE = { 'relocated_repo_access_is_ok': 'BORG_RELOCATED_REPO_ACCESS_IS_OK', 'unknown_unencrypted_repo_access_is_ok': 'BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK', + 'check_i_know_what_i_am_doing': 'BORG_CHECK_I_KNOW_WHAT_I_AM_DOING', } @@ -35,6 +36,6 @@ def make_environment(storage_config): environment_variable_name, ) in DEFAULT_BOOL_OPTION_TO_ENVIRONMENT_VARIABLE.items(): value = storage_config.get(option_name, False) - environment[environment_variable_name] = 'yes' if value else 'no' + environment[environment_variable_name] = 'YES' if value else 'NO' return environment diff --git a/borgmatic/config/schema.yaml b/borgmatic/config/schema.yaml index 3f1b3cb4..84b512ca 100644 --- a/borgmatic/config/schema.yaml +++ b/borgmatic/config/schema.yaml @@ -405,6 +405,12 @@ properties: Bypass Borg error about a previously unknown unencrypted repository. Defaults to false. example: true + check_i_know_what_i_am_doing: + type: boolean + description: | + Bypass Borg confirmation about check with repair option. + Defaults to false. + example: true extra_borg_options: type: object additionalProperties: false diff --git a/tests/unit/borg/test_environment.py b/tests/unit/borg/test_environment.py index 4cef39b9..a099c776 100644 --- a/tests/unit/borg/test_environment.py +++ b/tests/unit/borg/test_environment.py @@ -23,15 +23,22 @@ def test_make_environment_without_configuration_should_only_set_default_environm environment = module.make_environment({}) assert environment == { - 'BORG_RELOCATED_REPO_ACCESS_IS_OK': 'no', - 'BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK': 'no', + 'BORG_RELOCATED_REPO_ACCESS_IS_OK': 'NO', + 'BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK': 'NO', + 'BORG_CHECK_I_KNOW_WHAT_I_AM_DOING': 'NO', } def test_make_environment_with_relocated_repo_access_should_override_default(): environment = module.make_environment({'relocated_repo_access_is_ok': True}) - assert environment.get('BORG_RELOCATED_REPO_ACCESS_IS_OK') == 'yes' + assert environment.get('BORG_RELOCATED_REPO_ACCESS_IS_OK') == 'YES' + + +def test_make_environment_check_i_know_what_i_am_doing_should_override_default(): + environment = module.make_environment({'relocated_repo_access_is_ok': True}) + + assert environment.get('BORG_RELOCATED_REPO_ACCESS_IS_OK') == 'YES' def test_make_environment_with_integer_variable_value():