From 8b7e9aa84e95d2d58959a9cf73c21db39e3d0a83 Mon Sep 17 00:00:00 2001 From: John Dickinson Date: Fri, 5 Nov 2010 14:36:37 -0500 Subject: [PATCH] fixed to make tests work --- swift/common/middleware/cname_lookup.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/swift/common/middleware/cname_lookup.py b/swift/common/middleware/cname_lookup.py index 128b4a2b8f..d0ba2727c6 100644 --- a/swift/common/middleware/cname_lookup.py +++ b/swift/common/middleware/cname_lookup.py @@ -35,7 +35,7 @@ def lookup_cname(domain): # pragma: no cover result = result.rstrip('.') return ttl, result except DNSException: - return 0, domain + return 0, None class CNAMELookupMiddleware(object): @@ -79,12 +79,8 @@ class CNAMELookupMiddleware(object): memcache_key = ''.join(['cname-', given_domain]) self.memcache.set(memcache_key, found_domain, timeout=ttl) - if found_domain is None: - # something weird happened - error = True - break - elif found_domain == given_domain: - # we're at the last lookup + if found_domain is None or found_domain == a_domain: + # no CNAME records or we're at the last lookup error = True found_domain = None break