Merged lp:~notmyname/swift/cname_exception_bug - added NoAnswer error catching
This commit is contained in:
commit
1ab9614bfb
@ -17,7 +17,7 @@ from webob import Request
|
|||||||
from webob.exc import HTTPBadRequest
|
from webob.exc import HTTPBadRequest
|
||||||
import dns.resolver
|
import dns.resolver
|
||||||
from dns.exception import DNSException
|
from dns.exception import DNSException
|
||||||
from dns.resolver import NXDOMAIN
|
from dns.resolver import NXDOMAIN, NoAnswer
|
||||||
|
|
||||||
from swift.common.utils import cache_from_env, get_logger
|
from swift.common.utils import cache_from_env, get_logger
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ def lookup_cname(domain): # pragma: no cover
|
|||||||
result = answer.items[0].to_text()
|
result = answer.items[0].to_text()
|
||||||
result = result.rstrip('.')
|
result = result.rstrip('.')
|
||||||
return ttl, result
|
return ttl, result
|
||||||
except (DNSException, NXDOMAIN):
|
except (DNSException, NXDOMAIN, NoAnswer):
|
||||||
return 0, None
|
return 0, None
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user