summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2018-01-09 12:41:01 +0100
committerVolker Lendecke <vl@samba.org>2018-01-09 22:41:28 +0100
commit977b3f60cf0f504728f9b63343b9af1e8d6c359d (patch)
treea86139aca0d93a08aebfcdf510ef852d8706d4e6 /python
parent3022da1a7267f9038f1f0de98d8d54baabd9c567 (diff)
downloadsamba-977b3f60cf0f504728f9b63343b9af1e8d6c359d.tar.gz
python: Print the finddcs error message
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
Diffstat (limited to 'python')
-rw-r--r--python/samba/join.py3
-rw-r--r--python/samba/netcmd/domain.py3
2 files changed, 6 insertions, 0 deletions
diff --git a/python/samba/join.py b/python/samba/join.py
index 63e9b9010ed..9782f536dce 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 ada7d6b5f36..2cb14f150ec 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 = {