Ignore:
Timestamp:
Nov 6, 2008, 9:52:39 PM (16 years ago)
Author:
broder
Message:

In the web interface, validate names by querying against the local
nameserver

This fixes the case where the default nameserver is caching an old
value.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/invirt-web/code/validation.py

    r1495 r1542  
    274274    try:
    275275        hostname = '%s.%s.' % (name, config.dns.domains[0])
     276        resolver = dns.resolver.Resolver()
     277        resolver.nameservers = ['127.0.0.1']
    276278        try:
    277             dns.resolver.query(hostname, 'A')
     279            resolver.query(hostname, 'A')
    278280        except dns.resolver.NoAnswer, e:
    279281            # If we can get the TXT record, then we can verify it's
    280282            # reserved. If this lookup fails, let it bubble up and be
    281283            # dealt with
    282             answer = dns.resolver.query(hostname, 'TXT')
     284            answer = resolver.query(hostname, 'TXT')
    283285            txt = answer[0].strings[0]
    284286            if txt.startswith('reserved'):
Note: See TracChangeset for help on using the changeset viewer.