diff options
author | Giampaolo Lauria <lauria2@yahoo.com> | 2011-10-17 15:28:52 -0400 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2011-10-19 03:34:07 +0200 |
commit | 8dbf79941f029e7ddcb347c7436038c47eb8115e (patch) | |
tree | e98c57666954b22db2275d79f32477c058101448 | |
parent | 0c342f89860a4f64faf62340741b740603907c0e (diff) | |
download | samba-8dbf79941f029e7ddcb347c7436038c47eb8115e.tar.gz samba-8dbf79941f029e7ddcb347c7436038c47eb8115e.tar.bz2 samba-8dbf79941f029e7ddcb347c7436038c47eb8115e.zip |
samba-tool: Improve getopt.py error handling
Throw an exception when --option value is not in the form "a=b"
-rw-r--r-- | source4/scripting/python/samba/getopt.py | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/source4/scripting/python/samba/getopt.py b/source4/scripting/python/samba/getopt.py index c7035c1936..14cfba6241 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]) |