summaryrefslogtreecommitdiff
path: root/source4/scripting
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mdw@samba.org>2011-11-23 21:29:18 +0100
committerStefan Metzmacher <metze@samba.org>2011-11-27 12:51:57 +0100
commitf57f009bc600e214cf34de2ef825fe51eb25aeed (patch)
tree0e93b63e30ca2ce499c40205096770e4054ec573 /source4/scripting
parent08ca7d1634a6510655581bce141fb0200dad8c1c (diff)
downloadsamba-f57f009bc600e214cf34de2ef825fe51eb25aeed.tar.gz
samba-f57f009bc600e214cf34de2ef825fe51eb25aeed.tar.bz2
samba-f57f009bc600e214cf34de2ef825fe51eb25aeed.zip
samba-tool: domain info - add basic exception handling
It is nicer to get an error message rather than a stacktrace on wrong IP addresses. Signed-off-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'source4/scripting')
-rw-r--r--source4/scripting/python/samba/netcmd/domain.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/source4/scripting/python/samba/netcmd/domain.py b/source4/scripting/python/samba/netcmd/domain.py
index 4006a41eb0..a41a9d6734 100644
--- a/source4/scripting/python/samba/netcmd/domain.py
+++ b/source4/scripting/python/samba/netcmd/domain.py
@@ -87,8 +87,8 @@ class cmd_domain_info(Command):
def run(self, address, credopts=None, sambaopts=None, versionopts=None):
lp = sambaopts.get_loadparm()
- res = netcmd_get_domain_infos_via_cldap(lp, None, address)
- if res:
+ try:
+ res = netcmd_get_domain_infos_via_cldap(lp, None, address)
print "Forest : %s" % res.forest
print "Domain : %s" % res.dns_domain
print "Netbios domain : %s" % res.domain_name
@@ -96,6 +96,8 @@ class cmd_domain_info(Command):
print "DC netbios name : %s" % res.pdc_name
print "Server site : %s" % res.server_site
print "Client site : %s" % res.client_site
+ except RuntimeError:
+ raise CommandError("Invalid IP address '" + address + "'!")