samba-tool dns: Trap on conneciton errors and give useful info
authorAndrew Bartlett <abartlet@samba.org>
Fri, 7 Aug 2015 04:27:23 +0000 (16:27 +1200)
committerJeremy Allison <jra@samba.org>
Tue, 20 Oct 2015 18:22:22 +0000 (20:22 +0200)
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
python/samba/netcmd/dns.py

index 2cf9a1f13c554b5ac3f1507265ab256cb00755f2..7cedffcc28c942df785b7cc79d280f549f500b7e 100644 (file)
@@ -37,7 +37,11 @@ def dns_connect(server, lp, creds):
     if server.lower() == 'localhost':
         server = '127.0.0.1'
     binding_str = "ncacn_ip_tcp:%s[sign]" % server
-    dns_conn = dnsserver.dnsserver(binding_str, lp, creds)
+    try:
+        dns_conn = dnsserver.dnsserver(binding_str, lp, creds)
+    except RuntimeError, e:
+        raise CommandError('Connecting to DNS RPC server %s failed with %s' % (server, e))
+
     return dns_conn