diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2008-10-20 11:07:38 +0200 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2008-10-20 11:07:38 +0200 |
commit | 70eba79edb3cba9432508ff3c439200e980f9468 (patch) | |
tree | 7c1bee4412410a52799d243cc71e5ae456a31cc1 /source4/scripting | |
parent | 86576f0f1627bf799e422d16baac5a7057de0316 (diff) | |
parent | 221ea78e2e1688f2e79703784b3d1d1a68057604 (diff) | |
download | samba-70eba79edb3cba9432508ff3c439200e980f9468.tar.gz samba-70eba79edb3cba9432508ff3c439200e980f9468.tar.bz2 samba-70eba79edb3cba9432508ff3c439200e980f9468.zip |
Merge branch 'master' of ssh://git.samba.org/data/git/samba into selftest
Diffstat (limited to 'source4/scripting')
-rw-r--r-- | source4/scripting/python/samba/provision.py | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/source4/scripting/python/samba/provision.py b/source4/scripting/python/samba/provision.py index 4764d0cafa..823d5e6ff6 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, |