Use the machine name, not the hostname, field.
authorEric Price <ecprice@mit.edu>
Mon, 29 Oct 2007 03:16:12 +0000 (23:16 -0400)
committerEric Price <ecprice@mit.edu>
Mon, 29 Oct 2007 03:16:12 +0000 (23:16 -0400)
svn path=/trunk/dns/; revision=226

dnsserver.py

index c2069df..3cc8dc5 100644 (file)
@@ -30,10 +30,10 @@ class DatabaseAuthority(common.ResolverBase):
         results = []
         if cls == dns.IN and type in (dns.A, dns.ALL_RECORDS):
             host = name[:-len(self.domain)-1]
         results = []
         if cls == dns.IN and type in (dns.A, dns.ALL_RECORDS):
             host = name[:-len(self.domain)-1]
-            value = sipb_xen_database.NIC.get_by(hostname=host)
-            if value is None:
+            value = sipb_xen_database.Machine.get_by(name=host)
+            if value is None or not value.nics:
                 return defer.fail(failure.Failure(dns.AuthoritativeDomainError(name)))
                 return defer.fail(failure.Failure(dns.AuthoritativeDomainError(name)))
-            ip = value.ip
+            ip = value.nics[0].ip
             if ip is None:  #Deactivated?
                 return defer.fail(failure.Failure(dns.AuthoritativeDomainError(name)))
             ttl = 900
             if ip is None:  #Deactivated?
                 return defer.fail(failure.Failure(dns.AuthoritativeDomainError(name)))
             ttl = 900