summaryrefslogtreecommitdiffstats
path: root/python/samba/provision
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2015-03-02 13:22:37 +1300
committerStefan Metzmacher <metze@samba.org>2015-03-06 20:11:52 +0100
commit5b3c71cd9c4d20a04f7505ad904f95d0ecf5ac2e (patch)
tree9e0350b2a50dfa036ac4358e9325d35aef28dba9 /python/samba/provision
parent6fe8cd2fdfa770ceaa4ad87002db9cdc029dd532 (diff)
downloadsamba-5b3c71cd9c4d20a04f7505ad904f95d0ecf5ac2e.tar.gz
samba-5b3c71cd9c4d20a04f7505ad904f95d0ecf5ac2e.tar.xz
samba-5b3c71cd9c4d20a04f7505ad904f95d0ecf5ac2e.zip
provision: Give a more helpful message when find_provision_key_parameters() fails
Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Fri Mar 6 20:11:52 CET 2015 on sn-devel-104
Diffstat (limited to 'python/samba/provision')
-rw-r--r--python/samba/provision/__init__.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/python/samba/provision/__init__.py b/python/samba/provision/__init__.py
index 1603321bd8..953bd0f3bd 100644
--- a/python/samba/provision/__init__.py
+++ b/python/samba/provision/__init__.py
@@ -243,8 +243,11 @@ def find_provision_key_parameters(samdb, secretsdb, idmapdb, paths, smbconf,
# dns hostname and server dn
res4 = samdb.search(expression="(CN=%s)" % names.netbiosname,
- base="OU=Domain Controllers,%s" % basedn,
- scope=ldb.SCOPE_ONELEVEL, attrs=["dNSHostName"])
+ base="OU=Domain Controllers,%s" % basedn,
+ scope=ldb.SCOPE_ONELEVEL, attrs=["dNSHostName"])
+ if len(res4) == 0:
+ raise ProvisioningError("Unable to find DC called CN=%s under OU=Domain Controllers,%s" % (names.netbiosname, basedn))
+
names.hostname = str(res4[0]["dNSHostName"]).replace("." + names.dnsdomain, "")
server_res = samdb.search(expression="serverReference=%s" % res4[0].dn,