summaryrefslogtreecommitdiffstats
path: root/ipalib
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2011-01-10 17:16:25 -0500
committerRob Crittenden <rcritten@redhat.com>2011-01-11 10:22:33 -0500
commit06179dc105239496a7b0e55fc4a19ce576033565 (patch)
treefff1f4a85780dbfe10082a4e32df58e82b79432c /ipalib
parent371ce528fb75b9e10b197a469425fef42be59051 (diff)
downloadfreeipa-06179dc105239496a7b0e55fc4a19ce576033565.tar.gz
freeipa-06179dc105239496a7b0e55fc4a19ce576033565.tar.xz
freeipa-06179dc105239496a7b0e55fc4a19ce576033565.zip
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
Diffstat (limited to 'ipalib')
-rw-r--r--ipalib/plugins/dns.py14
1 files changed, 11 insertions, 3 deletions
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)