From 8dbf79941f029e7ddcb347c7436038c47eb8115e Mon Sep 17 00:00:00 2001 From: Giampaolo Lauria Date: Mon, 17 Oct 2011 15:28:52 -0400 Subject: samba-tool: Improve getopt.py error handling Throw an exception when --option value is not in the form "a=b" --- source4/scripting/python/samba/getopt.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source4/scripting/python/samba/getopt.py b/source4/scripting/python/samba/getopt.py index c7035c19365..14cfba62410 100644 --- a/source4/scripting/python/samba/getopt.py +++ b/source4/scripting/python/samba/getopt.py @@ -75,8 +75,7 @@ class SambaOptions(optparse.OptionGroup): def _set_option(self, option, opt_str, arg, parser): if arg.find('=') == -1: - print("--option takes a 'a=b' argument") - sys.exit(1) + raise optparse.OptionValueError("--option option takes a 'a=b' argument") a = arg.split('=') self._lp.set(a[0], a[1]) -- cgit v1.2.1