git.samba.org
/
sfrench
/
samba-autobuild
/
.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
8dbf799
)
samba-tool: Improve getopt.py error handling
author
Giampaolo Lauria
<lauria2@yahoo.com>
Mon, 17 Oct 2011 19:31:30 +0000
(15:31 -0400)
committer
Jelmer Vernooij
<jelmer@samba.org>
Wed, 19 Oct 2011 01:34:07 +0000
(
03:34
+0200)
Throw an exception when the --option value is invalid
source4/scripting/python/samba/getopt.py
patch
|
blob
|
history
diff --git
a/source4/scripting/python/samba/getopt.py
b/source4/scripting/python/samba/getopt.py
index 14cfba62410d2d02545c7d88e80e728223caa2a6..7f500ec63da2d6e12a6665ea06e515cefebe3960 100644
(file)
--- 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."""