summaryrefslogtreecommitdiff
path: root/source4/scripting
diff options
context:
space:
mode:
authorGiampaolo Lauria <lauria2@yahoo.com>2011-10-17 15:22:01 -0400
committerJelmer Vernooij <jelmer@samba.org>2011-10-19 03:34:07 +0200
commit0c342f89860a4f64faf62340741b740603907c0e (patch)
tree9e70489b242fe8db76afa087df538169f91d2907 /source4/scripting
parente1d2b47693375760473829056650bfe44f277a18 (diff)
downloadsamba-0c342f89860a4f64faf62340741b740603907c0e.tar.gz
samba-0c342f89860a4f64faf62340741b740603907c0e.tar.bz2
samba-0c342f89860a4f64faf62340741b740603907c0e.zip
samba-tool: Improve getopt.py error handling
Raise exception when -d or --debuglevel value is <0
Diffstat (limited to 'source4/scripting')
-rw-r--r--source4/scripting/python/samba/getopt.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/source4/scripting/python/samba/getopt.py b/source4/scripting/python/samba/getopt.py
index f939180066..c7035c1936 100644
--- a/source4/scripting/python/samba/getopt.py
+++ b/source4/scripting/python/samba/getopt.py
@@ -64,6 +64,9 @@ class SambaOptions(optparse.OptionGroup):
self._configfile = arg
def _set_debuglevel(self, option, opt_str, arg, parser):
+ if arg < 0:
+ raise optparse.OptionValueError("invalid %s option value: %s" %
+ (opt_str, arg))
self._lp.set('debug level', str(arg))
def _set_realm(self, option, opt_str, arg, parser):