summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/scripting/python/samba/provision.py19
-rw-r--r--source4/setup/provision.zone4
2 files changed, 17 insertions, 6 deletions
diff --git a/source4/scripting/python/samba/provision.py b/source4/scripting/python/samba/provision.py
index 4764d0cafa6..823d5e6ff67 100644
--- a/source4/scripting/python/samba/provision.py
+++ b/source4/scripting/python/samba/provision.py
@@ -959,13 +959,16 @@ def provision(setup_dir, message, session_info,
paths = provision_paths_from_lp(lp, names.dnsdomain)
if hostip is None:
- hostip = socket.getaddrinfo(names.hostname, None, socket.AF_INET, socket.AI_CANONNAME, socket.IPPROTO_IP)[0][-1][0]
+ try:
+ hostip = socket.getaddrinfo(names.hostname, None, socket.AF_INET, socket.AI_CANONNAME, socket.IPPROTO_IP)[0][-1][0]
+ except socket.gaierror, (socket.EAI_NODATA, msg):
+ hostip = None
if hostip6 is None:
try:
hostip6 = socket.getaddrinfo(names.hostname, None, socket.AF_INET6, socket.AI_CANONNAME, socket.IPPROTO_IP)[0][-1][0]
- except socket.gaierror:
- pass
+ except socket.gaierror, (socket.EAI_NODATA, msg):
+ hostip6 = None
if serverrole is None:
serverrole = lp.get("server role")
@@ -1426,12 +1429,20 @@ def create_zone_file(path, setup_path, dnsdomain, domaindn,
hostip6_base_line = ""
hostip6_host_line = ""
+ if hostip is not None:
+ hostip_base_line = " IN A " + hostip
+ hostip_host_line = hostname + " IN A " + hostip
+ else:
+ hostip_base_line = ""
+ hostip_host_line = ""
+
setup_file(setup_path("provision.zone"), path, {
"DNSPASS_B64": b64encode(dnspass),
"HOSTNAME": hostname,
"DNSDOMAIN": dnsdomain,
"REALM": realm,
- "HOSTIP": hostip,
+ "HOSTIP_BASE_LINE": hostip_base_line,
+ "HOSTIP_HOST_LINE": hostip_host_line,
"DOMAINGUID": domainguid,
"DATESTRING": time.strftime("%Y%m%d%H"),
"DEFAULTSITE": DEFAULTSITE,
diff --git a/source4/setup/provision.zone b/source4/setup/provision.zone
index 17ae3bb47a0..e7d600df879 100644
--- a/source4/setup/provision.zone
+++ b/source4/setup/provision.zone
@@ -10,10 +10,10 @@ $TTL 1W
1W ) ; minimum
IN NS ${HOSTNAME}
${HOSTIP6_BASE_LINE}
- IN A ${HOSTIP}
+${HOSTIP_BASE_LINE}
;
${HOSTIP6_HOST_LINE}
-${HOSTNAME} IN A ${HOSTIP}
+${HOSTIP_HOST_LINE}
gc._msdcs IN CNAME ${HOSTNAME}
${HOSTGUID}._msdcs IN CNAME ${HOSTNAME}
;