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 <mbasti@redhat.com>
This commit is contained in:
Petr Spacek 2016-06-29 19:35:35 +02:00 committed by Martin Basti
parent 2615103c68
commit 3b79ce005c

View File

@ -17,6 +17,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
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()