mirror of
https://github.com/samba-team/samba.git
synced 2025-08-04 08:22:08 +03:00
samba-tool: Improve getopt.py error handling
Throw an exception when the --option value is invalid
This commit is contained in:
committed by
Jelmer Vernooij
parent
8dbf79941f
commit
20f2034f38
@ -77,7 +77,11 @@ class SambaOptions(optparse.OptionGroup):
|
|||||||
if arg.find('=') == -1:
|
if arg.find('=') == -1:
|
||||||
raise optparse.OptionValueError("--option option takes a 'a=b' argument")
|
raise optparse.OptionValueError("--option option takes a 'a=b' argument")
|
||||||
a = arg.split('=')
|
a = arg.split('=')
|
||||||
self._lp.set(a[0], a[1])
|
try:
|
||||||
|
self._lp.set(a[0], a[1])
|
||||||
|
except Exception:
|
||||||
|
raise optparse.OptionValueError("invalid --option option value: %s"
|
||||||
|
% arg)
|
||||||
|
|
||||||
def get_loadparm(self):
|
def get_loadparm(self):
|
||||||
"""Return loadparm object with data specified on the command line."""
|
"""Return loadparm object with data specified on the command line."""
|
||||||
|
Reference in New Issue
Block a user