summaryrefslogtreecommitdiff
path: root/source4/scripting
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2009-12-28 20:37:48 +0100
committerJelmer Vernooij <jelmer@ganieda.vernstok.nl>2009-12-29 16:26:20 +0100
commit433f58f5a7490ba470dddc55e37325bb73cdba5c (patch)
tree3a0f667eaf519bed3a4f18fce6dfcf1d6c5b9fd8 /source4/scripting
parente60a40e287a1febdab98cc6cf81a80a8cb6bcfb2 (diff)
downloadsamba-433f58f5a7490ba470dddc55e37325bb73cdba5c.tar.gz
samba-433f58f5a7490ba470dddc55e37325bb73cdba5c.tar.bz2
samba-433f58f5a7490ba470dddc55e37325bb73cdba5c.zip
s4/net: Pass all arguments through to the Python commands.
Diffstat (limited to 'source4/scripting')
-rw-r--r--source4/scripting/python/samba/netcmd/__init__.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/source4/scripting/python/samba/netcmd/__init__.py b/source4/scripting/python/samba/netcmd/__init__.py
index 5c18d29fc3..cb8fa01fe1 100644
--- a/source4/scripting/python/samba/netcmd/__init__.py
+++ b/source4/scripting/python/samba/netcmd/__init__.py
@@ -19,6 +19,7 @@
import optparse
from samba import getopt as options, Ldb
+import sys
class Option(optparse.Option):
@@ -82,7 +83,11 @@ class Command(object):
if len(args) < len(self.takes_args):
self.usage(args)
return -1
- return self.run(*args, **kwargs)
+ try:
+ return self.run(*args, **kwargs)
+ except CommandError, e:
+ print >>sys.stderr, "ERROR: %s" % e
+ return -1
def run(self):
"""Run the command. This should be overriden by all subclasses."""
@@ -97,11 +102,7 @@ class SuperCommand(Command):
def run(self, subcommand, *args, **kwargs):
if not subcommand in subcommands:
print >>sys.stderr, "ERROR: No such subcommand '%s'" % subcommand
- try:
return subcommands[subcommand].run(*args, **kwargs)
- except CommandError, e:
- print >>sys.stderr, "ERROR: %s" % e.message
- return -1
def usage(self, subcommand=None, *args, **kwargs):
if subcommand is None: