From 0c342f89860a4f64faf62340741b740603907c0e Mon Sep 17 00:00:00 2001 From: Giampaolo Lauria Date: Mon, 17 Oct 2011 15:22:01 -0400 Subject: samba-tool: Improve getopt.py error handling Raise exception when -d or --debuglevel value is <0 --- source4/scripting/python/samba/getopt.py | 3 +++ 1 file changed, 3 insertions(+) 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): -- cgit