mirror of
https://github.com/borgbackup/borg.git
synced 2024-12-25 09:19:31 +00:00
Merge pull request #3674 from ThomasWaldmann/cache-config-validation
borg config --cache: allow validated access to previous_location
This commit is contained in:
commit
b812472f36
1 changed files with 6 additions and 4 deletions
|
@ -45,7 +45,7 @@
|
||||||
from .crypto.keymanager import KeyManager
|
from .crypto.keymanager import KeyManager
|
||||||
from .helpers import EXIT_SUCCESS, EXIT_WARNING, EXIT_ERROR
|
from .helpers import EXIT_SUCCESS, EXIT_WARNING, EXIT_ERROR
|
||||||
from .helpers import Error, NoManifestError, set_ec
|
from .helpers import Error, NoManifestError, set_ec
|
||||||
from .helpers import positive_int_validator, location_validator, archivename_validator, ChunkerParams
|
from .helpers import positive_int_validator, location_validator, archivename_validator, ChunkerParams, Location
|
||||||
from .helpers import PrefixSpec, SortBySpec, FilesCacheMode
|
from .helpers import PrefixSpec, SortBySpec, FilesCacheMode
|
||||||
from .helpers import BaseFormatter, ItemFormatter, ArchiveFormatter
|
from .helpers import BaseFormatter, ItemFormatter, ArchiveFormatter
|
||||||
from .helpers import format_timedelta, format_file_size, parse_file_size, format_archive
|
from .helpers import format_timedelta, format_file_size, parse_file_size, format_archive
|
||||||
|
@ -1559,9 +1559,11 @@ def repo_validate(section, name, value=None, check_value=True):
|
||||||
def cache_validate(section, name, value=None, check_value=True):
|
def cache_validate(section, name, value=None, check_value=True):
|
||||||
if section not in ['cache', ]:
|
if section not in ['cache', ]:
|
||||||
raise ValueError('Invalid section')
|
raise ValueError('Invalid section')
|
||||||
# I looked at the cache config and did not see anything a user would want to edit,
|
if name in ['previous_location', ]:
|
||||||
# so, for now, raise for any key name
|
if check_value:
|
||||||
raise ValueError('Invalid name')
|
Location(value)
|
||||||
|
else:
|
||||||
|
raise ValueError('Invalid name')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
section, name = args.name.split('.')
|
section, name = args.name.split('.')
|
||||||
|
|
Loading…
Reference in a new issue