From: Volker Lendecke Date: Tue, 9 Jan 2018 11:41:01 +0000 (+0100) Subject: python: Print the finddcs error message X-Git-Url: http://git.samba.org/?p=metze%2Fsamba%2Fwip.git;a=commitdiff_plain;h=977b3f60cf0f504728f9b63343b9af1e8d6c359d python: Print the finddcs error message Signed-off-by: Volker Lendecke Reviewed-by: Stefan Metzmacher Autobuild-User(master): Volker Lendecke Autobuild-Date(master): Tue Jan 9 22:41:28 CET 2018 on sn-devel-144 --- diff --git a/python/samba/join.py b/python/samba/join.py index 63e9b9010ed3..9782f536dce1 100644 --- a/python/samba/join.py +++ b/python/samba/join.py @@ -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 != "": diff --git a/python/samba/netcmd/domain.py b/python/samba/netcmd/domain.py index ada7d6b5f364..2cb14f150ecb 100644 --- a/python/samba/netcmd/domain.py +++ b/python/samba/netcmd/domain.py @@ -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 = {