def check_SOA_condition(self): """We need to check if the domain is the root domain in a zone. If the domain is the root domain, it will have an soa, but the master domain will have no soa (or it will have a a different soa). """ root_domain = find_root_domain( 'forward', self.domain.soa ) if root_domain is None: return if self.fqdn == root_domain.name: raise ValidationError("You cannot create a CNAME that points to a" "domain at the root of a zone.") return
def gen_reverse_soa(soa): """ Generate the SOA file along with all of it's $INCLUDE statements. """ # Find the first domain with the soa. This is the root of the zone. reverse_domains = soa.reversedomain_set.all() root_reverse_domain = find_root_domain('reverse', soa) if not root_reverse_domain: return data = render_soa( soa=soa, root_domain=root_reverse_domain,\ domains=reverse_domains, bind_path=BUILD_PATH,\ ) file_name = "%s.soa" % (root_reverse_domain.name) return (file_name, data)
def check_SOA_condition(self): """We need to check if the domain is the root domain in a zone. If the domain is the root domain, it will have an soa, but the master domain will have no soa (or it will have a a different soa). """ try: self.domain except ObjectDoesNotExist: return # Validation will fail eventually root_domain = find_root_domain(self.domain.soa) if root_domain is None: return if self.fqdn == root_domain.name: raise ValidationError("You cannot create a CNAME that points to " "the root of a zone.") return