(tmp_fd, tmpfile) = tempfile.mkstemp()
f = os.fdopen(tmp_fd, 'w')
- if d.nameservers != []:
+
+ # Getting this line right is really important. When we are under
+ # resolv_wrapper, then we want to use RESOLV_CONF and the
+ # nameserver therein. The issue is that this parameter forces us
+ # to only ever use that server, and not some other server that the
+ # NS record may point to, even as we get a ticket to that other
+ # server.
+ #
+ # Therefore we must not set this in production.
+
+ if os.getenv('RESOLV_CONF') and d.nameservers != []:
f.write('server %s\n' % d.nameservers[0])
+
if d.type == "A":
f.write("update %s %s %u A %s\n" % (op, normalised_name, default_ttl, d.ip))
if d.type == "AAAA":