From: Rob van der Linde Date: Thu, 5 Oct 2023 23:45:35 +0000 (+1300) Subject: python: netcmd: remove OptionError alias to OptionValueError X-Git-Tag: talloc-2.4.2~1129 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fb058e7f2ce3878713af959e8e35d1991bde24ee;p=thirdparty%2Fsamba.git python: netcmd: remove OptionError alias to OptionValueError 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 Reviewed-by: Douglas Bagnall Reviewed-by: Andrew Bartlett --- diff --git a/python/samba/getopt.py b/python/samba/getopt.py index 0b346b49286..691abe6e360 100644 --- a/python/samba/getopt.py +++ b/python/samba/getopt.py @@ -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):