Exemple #1
0
    def existing_node_check(self):
        """Make sure no other nodes exist at the level of this CNAME.

            "If a CNAME RR is present at a node, no other data should be
            present; this ensures that the data for
            a canonical name and its aliases cannot be different."

            -- `RFC 1034 <http://tools.ietf.org/html/rfc1034>`_

        For example, this would be bad::

            FOO.BAR.COM     CNAME       BEE.BAR.COM

            BEE.BAR.COM     A           128.193.1.1

            FOO.BAR.COM     TXT         "v=spf1 include:foo.com -all"

        If you queried the ``FOO.BAR.COM`` name, the class of the record
        that would be returned would be ambiguous.



        .. note::
            The following records classes are checked.
                * :class:`AddressRecord` (A and AAAA)
                * :class:`SRV`
                * :class:`TXT`
                * :class:`MX`
        """
        qset = fqdn_exists(self.fqdn, cn=False, dn=False, pt=False)
        if qset:
            objects = qset.all()
            raise ValidationError("Objects with this name already exist: {0}".
                                  format(objects))
Exemple #2
0
 def clean(self):
     self.master_domain = _name_to_master_domain(self.name)
     do_zone_validation(self)
     if self.pk is None:
         # The object doesn't exist in the db yet. Make sure we don't
         # conflict with existing objects.
         qset = fqdn_exists(self.name, pt=False)
         if qset:
             objects = qset.all()
             raise ValidationError("Objects with this name already " "exist {0}".format(objects))