mirror of
https://github.com/samba-team/samba.git
synced 2025-08-02 00:22:11 +03:00
samba.getopt: Keep exception message when setting a lp option fails.
This commit is contained in:
@ -75,13 +75,14 @@ class SambaOptions(optparse.OptionGroup):
|
|||||||
|
|
||||||
def _set_option(self, option, opt_str, arg, parser):
|
def _set_option(self, option, opt_str, arg, parser):
|
||||||
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('=')
|
||||||
try:
|
try:
|
||||||
self._lp.set(a[0], a[1])
|
self._lp.set(a[0], a[1])
|
||||||
except Exception:
|
except Exception, e:
|
||||||
raise optparse.OptionValueError("invalid --option option value: %s"
|
raise optparse.OptionValueError(
|
||||||
% arg)
|
"invalid --option option value %r: %s" % (arg, e))
|
||||||
|
|
||||||
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