From 6d51a48af8afc52a0bf3f9437b2de1c2b8c1c0d4 Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Tue, 23 Nov 2010 17:47:29 -0500 Subject: Add ability to add/remove DNS records when adding/removing a host entry. A host in DNS must have an IP address so a valid IP address is required when adding a host. The --force flag will be needed too since you are adding a host that isn't in DNS. For IPv4 it will create an A and a PTR DNS record. IPv6 isn't quite supported yet. Some basic work in the DNS installer is needed to get this working. Once the get_reverse_zone() returns the right value then this should start working and create an AAAA record and the appropriate reverse entry. When deleting a host with the --updatedns flag it will try to remove all records it can find in the zone for this host. ticket 238 --- ipalib/plugins/dns.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'ipalib/plugins/dns.py') diff --git a/ipalib/plugins/dns.py b/ipalib/plugins/dns.py index a3e6c1eeb..6f3959bcb 100644 --- a/ipalib/plugins/dns.py +++ b/ipalib/plugins/dns.py @@ -90,6 +90,18 @@ _record_types = ( u'SRV', u'TXT', ) +# mapping from attribute to resource record type +_attribute_types = dict( + arecord=u'A', aaaarecord=u'AAAA', a6record=u'A6', + afsdbrecord=u'AFSDB', certrecord=u'CERT', cnamerecord=u'CNAME', + dnamerecord=u'DNAME', dsrecord=u'DS', hinforecord=u'HINFO', + keyrecord=u'KEY', kxrecord=u'KX', locrecord='LOC', + mdrecord=u'MD', minforecord=u'MINFO', mxrecord=u'MX', + naptrrecord=u'NAPTR', nsrecord=u'NS', nsecrecord=u'NSEC', + ntxtrecord=u'NTXT', ptrrecord=u'PTR', rrsigrecord=u'RRSIG', + sshfprecord=u'SSHFP', srvrecord=u'SRV', txtrecord=u'TXT', +) + # supported DNS classes, IN = internet, rest is almost never used _record_classes = (u'IN', u'CS', u'CH', u'HS') @@ -137,6 +149,7 @@ def dns_container_exists(ldap): except errors.NotFound: raise errors.NotFound(reason=_('DNS is not configured')) + return True class dns(Object): """DNS zone/SOA record object.""" -- cgit