Browse Source

Quit with error message when no config key is provided. Fixes #4223

Manu 6 years ago
parent
commit
e155822474
2 changed files with 6 additions and 0 deletions
  1. 4 0
      src/borg/archiver.py
  2. 2 0
      src/borg/testsuite/archiver.py

+ 4 - 0
src/borg/archiver.py

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

+ 2 - 0
src/borg/testsuite/archiver.py

@@ -2793,6 +2793,8 @@ id: 2 / e29442 3506da 4e1ea7 / 25f62a 5a3d41 - 02
             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)
 
     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.')