Changeset 851 for trunk/packages


Ignore:
Timestamp:
Aug 3, 2008, 9:35:24 PM (16 years ago)
Author:
y_z
Message:
  • sipb_xen_database -> invirt.database
  • use invirt.config in dnsserver.py
Location:
trunk/packages/sipb-xen-dns
Files:
1 deleted
2 edited

Legend:

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

    r849 r851  
    77from twisted.python import failure
    88
    9 import sipb_xen_database
     9from invirt.config import structs as config
     10import invirt.database
    1011import psycopg2
    1112import sqlalchemy
     
    1718    soa = None
    1819
    19     def __init__(self, domains, database=None):
     20    def __init__(self, domains=None, database=None):
    2021        common.ResolverBase.__init__(self)
    2122        if database is not None:
    22             sipb_xen_database.connect(database)
    23         self.domains = domains
    24         self.soa = dns.Record_SOA(mname='ns1.xvm.mit.edu',
    25                                   rname='xvm.mit.edu',
     23            invirt.database.connect(database)
     24        else:
     25            invirt.database.connect()
     26        if domains is not None:
     27            self.domains = domains
     28        else:
     29            self.domains = config.dns.domains
     30        ns = config.dns.nameservers[0]
     31        self.soa = dns.Record_SOA(mname=ns.hostname,
     32                                  rname=config.dns.contact.replace('@','.',1),
    2633                                  serial=1, refresh=3600, retry=900,
    2734                                  expire=3600000, minimum=21600, ttl=3600)
    28         self.ns = dns.Record_NS(name='ns1.xvm.mit.edu', ttl=3600)
    29         record = dns.Record_A(address='18.181.0.62', ttl=3600)
    30         self.ns1 = dns.RRHeader('ns1.xvm.mit.edu', dns.A, dns.IN,
     35        self.ns = dns.Record_NS(name=ns.hostname, ttl=3600)
     36        record = dns.Record_A(address=ns.ip, ttl=3600)
     37        self.ns1 = dns.RRHeader(ns.hostname, dns.A, dns.IN,
    3138                                3600, record, auth=True)
    3239
     
    4653
    4754    def _lookup_unsafe(self, name, cls, type, timeout):
    48         sipb_xen_database.clear_cache()
     55        invirt.database.clear_cache()
    4956       
    5057        ttl = 900
     
    6875            if not host:
    6976                if type in (dns.A, dns.ALL_RECORDS):
    70                     record = dns.Record_A('18.181.0.62', ttl)
     77                    record = dns.Record_A(config.dns.nameservers[0].ip, ttl)
    7178                    results.append(dns.RRHeader(name, dns.A, dns.IN,
    7279                                                ttl, record, auth=True))
     
    8087            else:
    8188                if host:
    82                     value = sipb_xen_database.Machine.get_by(name=host)
     89                    value = invirt.database.Machine.get_by(name=host)
    8390                    if value is None or not value.nics:
    8491                        return defer.fail(failure.Failure(dns.AuthoritativeDomainError(name)))
     
    102109
    103110if '__main__' == __name__:
    104     resolver = DatabaseAuthority(['servers.csail.mit.edu',
    105                                   'xvm.mit.edu'],
    106                                  'postgres://sipb-xen@sipb-xen-dev/sipb_xen')
     111    resolver = DatabaseAuthority()
    107112
    108113    verbosity = 0
  • trunk/packages/sipb-xen-dns/debian/changelog

    r849 r851  
     1sipb-xen-dns (1.02) unstable; urgency=low
     2
     3  * sipb_xen_database -> invirt.database
     4  * use invirt.config in dnsserver.py
     5
     6 -- Yang Zhang <y_z@mit.edu>  Sun,  3 Aug 2008 19:18:40 -0400
     7
    18sipb-xen-dns (1.01) unstable; urgency=low
    29
Note: See TracChangeset for help on using the changeset viewer.