diff options
author | Joshua Harlow <harlowja@yahoo-inc.com> | 2012-07-03 20:14:57 -0700 |
---|---|---|
committer | Joshua Harlow <harlowja@yahoo-inc.com> | 2012-07-03 20:14:57 -0700 |
commit | 32ea55364e7688110646818dd651ed476b3c57f1 (patch) | |
tree | 56e4b4d33fc3a306a6247b927074a78ba6b999c4 /tools | |
parent | 101d19df1c71b559bf34cfec87894f84ea041810 (diff) | |
download | vyos-cloud-init-32ea55364e7688110646818dd651ed476b3c57f1.tar.gz vyos-cloud-init-32ea55364e7688110646818dd651ed476b3c57f1.zip |
When the hostname is also the ip (thus no hostname) just use 'localhost'
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/mock-meta.py | 8 |
1 files changed, 6 insertions, 2 deletions
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) |