mirror of
https://github.com/borgbackup/borg.git
synced 2024-12-26 09:47:58 +00:00
Merge pull request #5160 from fantasya-pbem/bugfix/borg-config-last-segment-checked
borg config --list does not show last_segment_checked, fixes #5159
This commit is contained in:
commit
08a12cc405
2 changed files with 18 additions and 1 deletions
|
@ -1659,7 +1659,7 @@ def do_config(self, args, repository):
|
|||
def repo_validate(section, name, value=None, check_value=True):
|
||||
if section not in ['repository', ]:
|
||||
raise ValueError('Invalid section')
|
||||
if name in ['segments_per_dir', 'max_segment_size', 'storage_quota', ]:
|
||||
if name in ['segments_per_dir', 'max_segment_size', 'storage_quota', 'last_segment_checked', ]:
|
||||
if check_value:
|
||||
try:
|
||||
int(value)
|
||||
|
@ -1716,6 +1716,11 @@ def list_config(config):
|
|||
if value is None:
|
||||
raise Error('The repository config is missing the %s key which has no default value' % key)
|
||||
print('%s = %s' % (key, value))
|
||||
for key in ['last_segment_checked', ]:
|
||||
value = config.get('repository', key, fallback=None)
|
||||
if value is None:
|
||||
continue
|
||||
print('%s = %s' % (key, value))
|
||||
|
||||
if not args.list:
|
||||
if args.name is None:
|
||||
|
|
|
@ -2991,6 +2991,17 @@ def test_config(self):
|
|||
self.assert_in('append_only', output)
|
||||
self.assert_in('additional_free_space', output)
|
||||
self.assert_in('id', output)
|
||||
self.assert_not_in('last_segment_checked', output)
|
||||
|
||||
output = self.cmd('config', self.repository_location, 'last_segment_checked', exit_code=1)
|
||||
self.assert_in('No option ', output)
|
||||
self.cmd('config', self.repository_location, 'last_segment_checked', '123')
|
||||
output = self.cmd('config', self.repository_location, 'last_segment_checked')
|
||||
assert output == '123' + '\n'
|
||||
output = self.cmd('config', '--list', self.repository_location)
|
||||
self.assert_in('last_segment_checked', output)
|
||||
self.cmd('config', '--delete', self.repository_location, 'last_segment_checked')
|
||||
|
||||
for cfg_key, cfg_value in [
|
||||
('additional_free_space', '2G'),
|
||||
('repository.append_only', '1'),
|
||||
|
@ -3002,6 +3013,7 @@ def test_config(self):
|
|||
assert output == cfg_value + '\n'
|
||||
self.cmd('config', '--delete', self.repository_location, cfg_key)
|
||||
self.cmd('config', self.repository_location, cfg_key, exit_code=1)
|
||||
|
||||
self.cmd('config', '--list', '--delete', self.repository_location, exit_code=2)
|
||||
self.cmd('config', self.repository_location, exit_code=2)
|
||||
self.cmd('config', self.repository_location, 'invalid-option', exit_code=1)
|
||||
|
|
Loading…
Reference in a new issue