From 32ea55364e7688110646818dd651ed476b3c57f1 Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Tue, 3 Jul 2012 20:14:57 -0700 Subject: When the hostname is also the ip (thus no hostname) just use 'localhost' --- tools/mock-meta.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'tools') diff --git a/tools/mock-meta.py b/tools/mock-meta.py index 5bbe62cc..247cff14 100755 --- a/tools/mock-meta.py +++ b/tools/mock-meta.py @@ -349,10 +349,14 @@ class Ec2Handler(BaseHTTPRequestHandler): raise WebException(httplib.BAD_REQUEST, "Unknown requested data %r" % look_name) base_func = func_mapping[look_name] who = self.address_string() + ip_from = self.client_address[0] + if who == ip_from: + # Nothing resolved, so just use 'localhost' + who = 'localhost' kwargs = { 'params': list(segments[2:]), - 'who': self.address_string(), - 'client_ip': self.client_address[0], + 'who': who, + 'client_ip': ip_from, } return functools.partial(base_func, **kwargs) -- cgit v1.2.3