1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2025-02-23 14:41:43 +00:00

Merge pull request #4281 from m3nu/issue/4223/config-crashing

Quit with error message when no config key is provided. Fixes #4223
This commit is contained in:
TW 2019-01-30 15:51:33 +01:00 committed by GitHub
commit c6cb1dc28b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 0 deletions

View file

@ -1620,6 +1620,10 @@ def list_config(config):
print('%s = %s' % (key, value)) print('%s = %s' % (key, value))
if not args.list: if not args.list:
if args.name is None:
self.print_error('No config key name was provided.')
return self.exit_code
try: try:
section, name = args.name.split('.') section, name = args.name.split('.')
except ValueError: except ValueError:

View file

@ -2793,6 +2793,8 @@ def test_config(self):
self.cmd('config', '--delete', self.repository_location, cfg_key) self.cmd('config', '--delete', self.repository_location, cfg_key)
self.cmd('config', self.repository_location, cfg_key, exit_code=1) 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', '--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)
requires_gnutar = pytest.mark.skipif(not have_gnutar(), reason='GNU tar must be installed for this test.') requires_gnutar = pytest.mark.skipif(not have_gnutar(), reason='GNU tar must be installed for this test.')
requires_gzip = pytest.mark.skipif(not shutil.which('gzip'), reason='gzip must be installed for this test.') requires_gzip = pytest.mark.skipif(not shutil.which('gzip'), reason='gzip must be installed for this test.')