def render(self, session, fqdn, dns_domain, comments, **arguments): dbdns_domain = DnsDomain.get_unique(session, dns_domain, compel=True) dba_rec = ARecord.get_unique(session, fqdn=fqdn, compel=True) NsRecord.get_unique(session, a_record=dba_rec, dns_domain=dbdns_domain, preclude=True) ns_record = NsRecord(a_record=dba_rec, dns_domain=dbdns_domain, comments=comments) session.add(ns_record) return
def render(self, session, fqdn, dns_domain, **arguments): dbdns_domain = DnsDomain.get_unique(session, dns_domain, compel=True) dba_rec = ARecord.get_unique(session, fqdn=fqdn, compel=True) ns_record = NsRecord.get_unique(session, dns_domain=dbdns_domain, a_record=dba_rec, compel=True) session.delete(ns_record) return
def test_ns_record(): """ test creating a valid ns record """ tgt = ARecord.get_unique(sess, fqdn='%s.%s' % (AREC_NAME, DNS_DOMAIN_NAME), compel=True) dmn = DnsDomain.get_unique(sess, name=DNS_DOMAIN_NAME, compel=True) ns = NsRecord(a_record=tgt, dns_domain=dmn) create(sess, ns) assert ns, 'No NS Record created in test_ns_record' print 'created %s' % ns assert dmn.servers, 'No name server association proxy in test_ns_record'
def teardown(): ip = IPv4Address(TEST_IP) arec = ARecord.get_unique(sess, fqdn='%s.%s' % (AREC_NAME, DNS_DOMAIN_NAME), compel=True) dmn = DnsDomain.get_unique(sess, DNS_DOMAIN_NAME, compel=True) #Test deletion of NSRecord doesn't affect the ARecord or DNS Domain #by deleting it first. ns = NsRecord.get_unique(sess, a_record=arec, dns_domain=dmn) sess.delete(ns) commit(sess) sess.delete(arec) commit(sess) sess.delete(dmn) commit(sess) sess.query(Network).filter_by(name=TEST_NET_NAME).delete() commit(sess)