Merge lp:~colin-nicholson/swift/cname_exception_bug into lp:~hudson-openstack/swift/trunk

Proposed by Colin Nicholson
Status: Merged
Approved by: Chuck Thier
Approved revision: 189
Merged at revision: 188
Proposed branch: lp:~colin-nicholson/swift/cname_exception_bug
Merge into: lp:~hudson-openstack/swift/trunk
Diff against target: 18 lines (+2/-1)
1 file modified
swift/common/middleware/cname_lookup.py (+2/-1)
To merge this branch: bzr merge lp:~colin-nicholson/swift/cname_exception_bug
Reviewer Review Type Date Requested Status
Chuck Thier (community) Approve
John Dickinson Approve
Review via email: mp+46929@code.launchpad.net

Description of the change

During a CNAME lookup, exception NXDOMAIN isn't caught by the check for DNSException, so need to also check for it.

To post a comment you must log in.
189. By Colin Nicholson

Merged lp:~notmyname/swift/cname_exception_bug - added NoAnswer error catching

Revision history for this message
John Dickinson (notmyname) wrote :

NXDOMAIN is raised when an IP is used as the host header. that is fixed

NoAnswer is raised if the CNAME record doesn't exist. that is fixed

review: Approve
Revision history for this message
Chuck Thier (cthier) wrote :

Cool

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'swift/common/middleware/cname_lookup.py'
2--- swift/common/middleware/cname_lookup.py 2011-01-14 08:45:39 +0000
3+++ swift/common/middleware/cname_lookup.py 2011-01-20 20:53:25 +0000
4@@ -17,6 +17,7 @@
5 from webob.exc import HTTPBadRequest
6 import dns.resolver
7 from dns.exception import DNSException
8+from dns.resolver import NXDOMAIN, NoAnswer
9
10 from swift.common.utils import cache_from_env, get_logger
11
12@@ -34,7 +35,7 @@
13 result = answer.items[0].to_text()
14 result = result.rstrip('.')
15 return ttl, result
16- except DNSException:
17+ except (DNSException, NXDOMAIN, NoAnswer):
18 return 0, None
19
20