mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
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 <rob@catalyst.net.nz> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
parent
14b2129868
commit
fb058e7f2c
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user