From: Salvatore Orlando Date: Tue, 1 Sep 2015 17:56:58 +0000 (-0700) Subject: Return version info on version controller X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=6f585ca08a19a0e24232885dfe2490f117b30b3b;p=openstack-build%2Fneutron-build.git Return version info on version controller Just like the global root controller "/" returns info for all versions, with this change the version root controller "/" will return info about the selected version. The patch also ensures the root version controller only accepts GET requests. Change-Id: I183c6ff67597fe93e394fc8f07d7229112d4e215 --- diff --git a/neutron/pecan_wsgi/controllers/root.py b/neutron/pecan_wsgi/controllers/root.py index 396778bac..ad0158a9a 100644 --- a/neutron/pecan_wsgi/controllers/root.py +++ b/neutron/pecan_wsgi/controllers/root.py @@ -87,6 +87,17 @@ class V2Controller(object): extensions = ExtensionsController() + @expose(generic=True) + def index(self): + builder = versions_view.get_view_builder(pecan.request) + return dict(version=builder.build(self.version_info)) + + @when(index, method='POST') + @when(index, method='PUT') + @when(index, method='DELETE') + def not_supported(self): + pecan.abort(405) + @expose() def _lookup(self, endpoint, *remainder): return CollectionsController(endpoint), remainder