From 3b79ce005c43c6cb270175dc987eed3ba19e0f53 Mon Sep 17 00:00:00 2001 From: Petr Spacek Date: Wed, 29 Jun 2016 19:35:35 +0200 Subject: DNS: Reinitialize DNS resolver after changing resolv.conf Previously the installer did not reinitialize resolver so queries for records created using --ip-address option might not be answered. This led to incorrect results during 'Updating DNS system records' phase at the end of installation. This is kind of hack but right now we do not have enough time to extend python-dns's interface with resolver_reinit() method. https://fedorahosted.org/freeipa/ticket/5962 Reviewed-By: Martin Basti --- ipaserver/install/bindinstance.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ipaserver/install/bindinstance.py b/ipaserver/install/bindinstance.py index ebb4212ab..f4ed63141 100644 --- a/ipaserver/install/bindinstance.py +++ b/ipaserver/install/bindinstance.py @@ -17,6 +17,7 @@ # along with this program. If not, see . # +from __future__ import absolute_import from __future__ import print_function import tempfile @@ -27,6 +28,7 @@ import re import sys import time +import dns.resolver import ldap import six @@ -982,6 +984,10 @@ class BindInstance(service.Service): resolv_fd.close() except IOError as e: root_logger.error('Could not write to resolv.conf: %s', e) + else: + # python DNS might have global resolver cached in this variable + # we have to re-initialize it because resolv.conf has changed + dns.resolver.default_resolver = None def __generate_rndc_key(self): installutils.check_entropy() -- cgit