diff options
author | Petr Viktorin <pviktori@redhat.com> | 2012-10-19 12:22:33 -0400 |
---|---|---|
committer | Rob Crittenden <rcritten@redhat.com> | 2012-10-23 18:40:37 -0400 |
commit | e4853ebc5910a526c74cc422fd3c1806708bc7aa (patch) | |
tree | 7c2137e5225aa70b34f949bac0bac813af76b03f /install/tools | |
parent | 6e1a8067093745704f9feca8598a61dfc63fe2cb (diff) | |
download | freeipa-e4853ebc5910a526c74cc422fd3c1806708bc7aa.tar.gz freeipa-e4853ebc5910a526c74cc422fd3c1806708bc7aa.tar.xz freeipa-e4853ebc5910a526c74cc422fd3c1806708bc7aa.zip |
ipa-replica-install: Use configured IPA DNS servers in forward/reverse resolution check
Previously, ipa-replica-install tried to check DNS resolution on the master
being cloned. If that master was not a DNS server, the check failed.
Change the check to query the first available configured DNS server.
Log about the check before actually running it.
Log in the case the check is skipped (no IPA DNS servers installed).
https://fedorahosted.org/freeipa/ticket/3194
Diffstat (limited to 'install/tools')
-rwxr-xr-x | install/tools/ipa-replica-install | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/install/tools/ipa-replica-install b/install/tools/ipa-replica-install index b56fa2ea5..e39698914 100755 --- a/install/tools/ipa-replica-install +++ b/install/tools/ipa-replica-install @@ -313,12 +313,23 @@ def check_bind(): sys.exit(1) -def check_dns_resolution(host_name, dns_server): - """Check forward and reverse resolution of host_name using dns_server +def check_dns_resolution(host_name, dns_servers): + """Check forward and reverse resolution of host_name using dns_servers """ # Point the resolver at specified DNS server - server_ips = list( - a[4][0] for a in socket.getaddrinfo(dns_server, None)) + server_ips = [] + for dns_server in dns_servers: + try: + server_ips = list( + a[4][0] for a in socket.getaddrinfo(dns_server, None)) + except socket.error: + pass + else: + break + if not server_ips: + root_logger.error( + 'Could not resolve any DNS server hostname: %s', dns_servers) + return False resolver = dns.resolver.Resolver() resolver.nameservers = server_ips @@ -547,15 +558,18 @@ def main(): config.master_host_name, config.dirman_password): dns_masters = api.Object['dnsrecord'].get_dns_masters() if dns_masters: - master = config.master_host_name if not options.no_host_dns: - resolution_ok = ( - check_dns_resolution(master, master) and - check_dns_resolution(config.host_name, master)) + master = config.master_host_name root_logger.debug('Check forward/reverse DNS resolution') + resolution_ok = ( + check_dns_resolution(master, dns_masters) and + check_dns_resolution(config.host_name, dns_masters)) if not resolution_ok and not options.unattended: if not ipautil.user_input("Continue?", False): sys.exit(0) + else: + root_logger.debug('No IPA DNS servers, ' + 'skipping forward/reverse resolution check') # Check that we don't already have a replication agreement try: |