]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
python: netcmd: remove OptionError alias to OptionValueError
authorRob van der Linde <rob@catalyst.net.nz>
Thu, 5 Oct 2023 23:45:35 +0000 (12:45 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 24 Oct 2023 23:31:29 +0000 (23:31 +0000)
The other methods in this file already raise optparse.OptionValueError
directly, except for two older ones.

They are using an alias which changes the name to OptionError, the
confusing part about this is that optparse.OptionError actually does
exist, so the incorrect alias needs to be removed.

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/getopt.py

index 0b346b492865d803ce711ab77af29dd1acf14a2c..691abe6e360b62b2af7535f63b2951b272d51768 100644 (file)
@@ -33,8 +33,6 @@ from samba.credentials import (
 )
 from samba._glue import get_burnt_commandline
 
-OptionError = optparse.OptionValueError
-
 
 def check_bytes(option, opt, value):
     """Custom option type to allow the input of sizes using byte, kb, mb ...
@@ -172,14 +170,16 @@ class SambaOptions(optparse.OptionGroup):
         try:
             self._lp.set('debug level', arg)
         except RuntimeError:
-            raise OptionError(f"invalid -d/--debug value: '{arg}'")
+            raise optparse.OptionValueError(
+                f"invalid -d/--debug value: '{arg}'")
         parser.values.debuglevel = arg
 
     def _set_realm(self, option, opt_str, arg, parser):
         try:
             self._lp.set('realm', arg)
         except RuntimeError:
-            raise OptionError(f"invalid --realm value: '{arg}'")
+            raise optparse.OptionValueError(
+                f"invalid --realm value: '{arg}'")
         self.realm = arg
 
     def _set_option(self, option, opt_str, arg, parser):