python: Print the finddcs error message
authorVolker Lendecke <vl@samba.org>
Tue, 9 Jan 2018 11:41:01 +0000 (12:41 +0100)
committerVolker Lendecke <vl@samba.org>
Tue, 9 Jan 2018 21:41:28 +0000 (22:41 +0100)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Tue Jan  9 22:41:28 CET 2018 on sn-devel-144

python/samba/join.py
python/samba/netcmd/domain.py

index 63e9b9010ed355fe0a0a28a4b630f2c07110efec..9782f536dce1f4bf3ca165c2eeb65957a44d9a33 100644 (file)
@@ -336,6 +336,9 @@ class dc_join(object):
         """find a writeable DC for the given domain"""
         try:
             ctx.cldap_ret = ctx.net.finddc(domain=domain, flags=nbt.NBT_SERVER_LDAP | nbt.NBT_SERVER_DS | nbt.NBT_SERVER_WRITABLE)
+        except NTSTATUSError as error:
+            raise Exception("Failed to find a writeable DC for domain '%s': %s" %
+                            (domain, error[1]))
         except Exception:
             raise Exception("Failed to find a writeable DC for domain '%s'" % domain)
         if ctx.cldap_ret.client_site is not None and ctx.cldap_ret.client_site != "":
index ada7d6b5f3640eb93004fac66a234249b4de5292..2cb14f150ecbe848ba284022d9934cb3ccba43af 100644 (file)
@@ -1771,6 +1771,9 @@ class DomainTrustCommand(Command):
             if require_pdc:
                 remote_flags |= nbt.NBT_SERVER_PDC
             remote_info = remote_net.finddc(flags=remote_flags, domain=domain, address=remote_server)
+        except NTSTATUSError as error:
+            raise CommandError("Failed to find a writeable DC for domain '%s': %s" %
+                               (domain, error[1]))
         except Exception:
             raise CommandError("Failed to find a writeable DC for domain '%s'" % domain)
         flag_map = {