also catch NXDOMAIN exception

This commit is contained in:
Colin Nicholson
2011-01-20 16:01:37 +00:00
parent e784f1c3a4
commit 66bef83cbc

View File

@@ -17,6 +17,7 @@ from webob import Request
from webob.exc import HTTPBadRequest
import dns.resolver
from dns.exception import DNSException
from dns.resolver import NXDOMAIN
from swift.common.utils import cache_from_env, get_logger
@@ -34,7 +35,7 @@ def lookup_cname(domain): # pragma: no cover
result = answer.items[0].to_text()
result = result.rstrip('.')
return ttl, result
except DNSException:
except (DNSException, NXDOMAIN):
return 0, None