From 06179dc105239496a7b0e55fc4a19ce576033565 Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Mon, 10 Jan 2011 17:16:25 -0500 Subject: Exit if a DNS A or AAAA record doesn't exist for the replica we are preparing. Without this it is possible to prepare a replica for a host that doesn't exist in DNS. The result when this replica file is installed is that replication will fail because the master won't be able to communicate to the replica by name. ticket 680 --- ipalib/plugins/dns.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'ipalib') diff --git a/ipalib/plugins/dns.py b/ipalib/plugins/dns.py index 88baee814..ced13efc9 100644 --- a/ipalib/plugins/dns.py +++ b/ipalib/plugins/dns.py @@ -923,9 +923,17 @@ class dns_resolve(Command): query = '%s.%s.' % (query, api.env.domain) if query[-1] != '.': query = query + '.' - rr = dnsclient.query(query, dnsclient.DNS_C_IN, dnsclient.DNS_T_A) - self.log.debug('%s' % rr) - if len(rr) == 0: + reca = dnsclient.query(query, dnsclient.DNS_C_IN, dnsclient.DNS_T_A) + rec6 = dnsclient.query(query, dnsclient.DNS_C_IN, dnsclient.DNS_T_AAAA) + records = reca + rec6 + found = False + for rec in records: + if rec.dns_type == dnsclient.DNS_T_A or \ + rec.dns_type == dnsclient.DNS_T_AAAA: + found = True + break + + if not found: raise errors.NotFound(reason=_('Host \'%(host)s\' not found' % {'host':query})) return dict(result=True, value=query) -- cgit