Add a config entry for BORG_CHECK_I_KNOW_WHAT_I_AM_DOING env var
This commit is contained in:
parent
acb2ca79d9
commit
1174eda171
|
@ -15,6 +15,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,4 +36,4 @@ def initialize(storage_config):
|
|||
environment_variable_name,
|
||||
) in DEFAULT_BOOL_OPTION_TO_ENVIRONMENT_VARIABLE.items():
|
||||
value = storage_config.get(option_name, False)
|
||||
os.environ[environment_variable_name] = 'yes' if value else 'no'
|
||||
os.environ[environment_variable_name] = 'YES' if value else 'NO'
|
||||
|
|
|
@ -324,6 +324,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
|
||||
|
|
|
@ -44,8 +44,9 @@ def test_initialize_without_configuration_should_only_set_default_environment():
|
|||
module.initialize({})
|
||||
|
||||
assert {key: value for key, value in os.environ.items() if key.startswith('BORG_')} == {
|
||||
'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',
|
||||
}
|
||||
finally:
|
||||
os.environ = orig_environ
|
||||
|
@ -57,7 +58,17 @@ def test_initialize_with_relocated_repo_access_should_override_default():
|
|||
try:
|
||||
os.environ = {}
|
||||
module.initialize({'relocated_repo_access_is_ok': True})
|
||||
assert os.environ.get('BORG_RELOCATED_REPO_ACCESS_IS_OK') == 'yes'
|
||||
assert os.environ.get('BORG_RELOCATED_REPO_ACCESS_IS_OK') == 'YES'
|
||||
finally:
|
||||
os.environ = orig_environ
|
||||
|
||||
def test_initialize_with_check_i_know_what_i_am_doing_should_override_default():
|
||||
orig_environ = os.environ
|
||||
|
||||
try:
|
||||
os.environ = {}
|
||||
module.initialize({'check_i_know_what_i_am_doing': True})
|
||||
assert os.environ.get('BORG_CHECK_I_KNOW_WHAT_I_AM_DOING') == 'YES'
|
||||
finally:
|
||||
os.environ = orig_environ
|
||||
|
||||
|
|
Loading…
Reference in New Issue