From 0b0db74aeb799390c4d72a3355d9bf3aa04fd517 Mon Sep 17 00:00:00 2001 From: Zhiteng Huang Date: Tue, 26 Jun 2012 01:37:28 +0800 Subject: Allow access to metadata server '/' without IP check Allow access to '/' of metadata server to get version information without checking source IP, which was how previous release behave. Fix bug 1017759. Change-Id: I3edc2d3808b0ebb2064513a59e6a3fc9e212b283 --- nova/api/metadata/handler.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'nova/api') diff --git a/nova/api/metadata/handler.py b/nova/api/metadata/handler.py index f4f6b689c..59a7d030e 100644 --- a/nova/api/metadata/handler.py +++ b/nova/api/metadata/handler.py @@ -17,6 +17,7 @@ # under the License. """Metadata request handler.""" +import os import webob.dec import webob.exc @@ -67,6 +68,9 @@ class MetadataRequestHandler(wsgi.Application): if FLAGS.use_forwarded_for: remote_address = req.headers.get('X-Forwarded-For', remote_address) + if os.path.normpath("/" + req.path_info) == "/": + return(base.ec2_md_print(base.VERSIONS + ["latest"])) + try: meta_data = self.get_metadata(remote_address) except Exception: -- cgit