summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorGiampaolo Lauria <lauria2@yahoo.com>2011-10-17 15:31:30 -0400
committerJelmer Vernooij <jelmer@samba.org>2011-10-19 03:34:07 +0200
commit20f2034f380cf13b41ad5054a50edef72e18a6c2 (patch)
tree4305a6e534e9bae3f3e4ed7989c98b5193c6a0c4 /source4
parent8dbf79941f029e7ddcb347c7436038c47eb8115e (diff)
downloadsamba-20f2034f380cf13b41ad5054a50edef72e18a6c2.tar.gz
samba-20f2034f380cf13b41ad5054a50edef72e18a6c2.tar.bz2
samba-20f2034f380cf13b41ad5054a50edef72e18a6c2.zip
samba-tool: Improve getopt.py error handling
Throw an exception when the --option value is invalid
Diffstat (limited to 'source4')
-rw-r--r--source4/scripting/python/samba/getopt.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/source4/scripting/python/samba/getopt.py b/source4/scripting/python/samba/getopt.py
index 14cfba6241..7f500ec63d 100644
--- a/source4/scripting/python/samba/getopt.py
+++ b/source4/scripting/python/samba/getopt.py
@@ -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."""