def migrate_TXT(zone, root_domain, soa, views): for (name, ttl, rdata) in zone.iterate_rdatas('TXT'): name = name.to_text().strip('.') print str(name) + " TXT " + str(rdata) exists_domain = Domain.objects.filter(name=name) if exists_domain: label = '' domain = exists_domain[0] else: label = name.split('.')[0] domain_name = name.split('.')[1:] domain = ensure_domain('.'.join(domain_name), force=True) data = rdata.to_text().strip('"') if not TXT.objects.filter(label=label, domain=domain, txt_data=data).exists(): txt = TXT(label=label, domain=domain, txt_data=data) txt.full_clean() txt.save() for view in views: txt.views.add(view) txt.save()
print str(name) + " TXT " + str(rdata) exists_domain = Domain.objects.filter(name=name) if exists_domain: label = '' domain = exists_domain[0] else: label = name.split('.')[0] domain_name = name.split('.')[1:] domain = ensure_domain('.'.join(domain_name)) data = rdata.to_text().strip('"') if not TXT.objects.filter(label=label, domain=domain, txt_data=data).exists(): txt = TXT(label=label, domain=domain, txt_data=data) txt.full_clean() txt.save() if views: for view in views: txt.views.add(view) txt.save() for (name, ttl, rdata) in zone.iterate_rdatas('SSHFP'): name = name.to_text().strip('.') pdb.set_trace() print str(name) + " SSHFP " + str(rdata) for (name, ttl, rdata) in zone.iterate_rdatas('SRV'): target = rdata.target.to_text().strip('.') if target == "": target = "."
name = name.to_text().strip('.') print str(name) + " TXT " + str(rdata) exists_domain = Domain.objects.filter(name=name) if exists_domain: label = '' domain = exists_domain[0] else: label = name.split('.')[0] domain_name = name.split('.')[1:] domain = ensure_domain('.'.join(domain_name)) data = rdata.to_text().strip('"') if not TXT.objects.filter(label=label, domain=domain, txt_data=data).exists(): txt = TXT(label=label, domain=domain, txt_data=data) txt.full_clean() txt.save() if views: for view in views: txt.views.add(view) txt.save() for (name, ttl, rdata) in zone.iterate_rdatas('SSHFP'): name = name.to_text().strip('.') pdb.set_trace() print str(name) + " SSHFP " + str(rdata) for (name, ttl, rdata) in zone.iterate_rdatas('SRV'): target = rdata.target.to_text().strip('.') if target == "": target = "."