Changeset 508 for trunk


Ignore:
Timestamp:
May 8, 2008, 5:22:04 AM (16 years ago)
Author:
ecprice
Message:

CNAME xvm.mit.edu to sipb-xen-dev.mit.edu

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/sipb-xen-dns/code/dnsserver.py

    r505 r508  
    4444            domain = name.lower()
    4545        else:
    46             found = False
    4746            for domain in self.domains:
    4847                if name.lower().endswith('.'+domain):
    49                     found = True
    5048                    break
    51             if not found:
    52                 #Not us
     49            else: #Not us
    5350                return defer.fail(failure.Failure(dns.DomainError(name)))
    5451        results = []
    5552        if cls == dns.IN and type in (dns.A, dns.ALL_RECORDS):
    5653            host = name[:-len(domain)-1]
    57             value = sipb_xen_database.Machine.get_by(name=host)
    58             if value is None or not value.nics:
    59                 return defer.fail(failure.Failure(dns.AuthoritativeDomainError(name)))
    60             ip = value.nics[0].ip
    61             if ip is None:  #Deactivated?
    62                 return defer.fail(failure.Failure(dns.AuthoritativeDomainError(name)))
    63             ttl = 900
    64             record = dns.Record_A(ip, ttl)
    65             results.append(dns.RRHeader(name, dns.A, dns.IN,
    66                                         ttl, record, auth=True))
     54            if not host:
     55                ttl = 900
     56                record = dns.Record_CNAME('sipb-xen-dev.mit.edu', ttl)
     57                results.append(dns.RRHeader(name, dns.CNAME, dns.IN,
     58                                            ttl, record, auth=True))
     59            else:
     60                value = sipb_xen_database.Machine.get_by(name=host)
     61                if value is None or not value.nics:
     62                    return defer.fail(failure.Failure(dns.AuthoritativeDomainError(name)))
     63                ip = value.nics[0].ip
     64                if ip is None:  #Deactivated?
     65                    return defer.fail(failure.Failure(dns.AuthoritativeDomainError(name)))
     66                ttl = 900
     67                record = dns.Record_A(ip, ttl)
     68                results.append(dns.RRHeader(name, dns.A, dns.IN,
     69                                            ttl, record, auth=True))
    6770        authority = []
    6871        authority.append(dns.RRHeader(domain, dns.SOA, dns.IN, 3600,
Note: See TracChangeset for help on using the changeset viewer.