Esempio n. 1
0
 def __init__(self, domain):
     """
     Initialise resolver from zone list
     Stores RRs as a list of (label, type, rr) tuples
     """
     self.domain = domain
     self.zone = zone.Zone(domain)
     self._tcp_server = None
     self._udp_server = None
Esempio n. 2
0
 def sync(self, vms=None):
     z = zone.Zone(self.domain)
     vms = vms or self._one.vms()
     vms.sort(key=lambda x: x.id)
     for vm in vms:
         try:
             self.add_vm(vm, zone=z)
         except exception.NoNetworksError as e:
             e.log(warn=True)
         except exception.DuplicateVMError as e:
             e.log(warn=True)
     self.load(z)
Esempio n. 3
0
def test_load_zone(dns):
    new_ip = IP(IP(conftest.HOST_IP).int() + 1)
    new_zone = zone.Zone(conftest.DOMAIN)
    new_zone.add_host(conftest.HOST, new_ip)
    _clear_and_add_test_host(dns, conftest.HOST, conftest.HOST_IP)
    try:
        a = utils.dnsquery(conftest.HOST, dnslib.QTYPE.A)
        assert a.short() == conftest.HOST_IP
        dns.load(new_zone)
        a = utils.dnsquery(conftest.HOST, dnslib.QTYPE.A)
        assert a.short() == str(new_ip)
    finally:
        dns.close()
Esempio n. 4
0
def onezone():
    z = zone.Zone(DOMAIN)
    z.add_host(HOST_SHORT, HOST_IP)
    for name, ip in TEST_GET_FQDN_DATA:
        z.add_host(name, ip)
    return z