1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

samba-tool: Improve getopt.py error handling

Throw an exception when the --option value is invalid
This commit is contained in:
Giampaolo Lauria 2011-10-17 15:31:30 -04:00 committed by Jelmer Vernooij
parent 8dbf79941f
commit 20f2034f38

View File

@ -77,7 +77,11 @@ class SambaOptions(optparse.OptionGroup):
if arg.find('=') == -1:
raise optparse.OptionValueError("--option option takes a 'a=b' argument")
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):
"""Return loadparm object with data specified on the command line."""