From: Steven Hardy Date: Fri, 10 May 2013 16:09:34 +0000 (+0100) Subject: api : Fix template-show partial URL redirect X-Git-Tag: 2014.1~621^2 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=53127b3e7242585337733de604aa3e192acbb7e9;p=openstack-build%2Fheat-build.git api : Fix template-show partial URL redirect All other API actions will provide a redirect if you only provide the stack ID or name (rather than both), the template URL currently doesn't because the template subpath is missing from the mapper lookup Fixes bug #1178705 Change-Id: Ib8e8dd7691bc48587c9d91e937ac2c2c35ac3ce6 --- diff --git a/heat/api/openstack/v1/__init__.py b/heat/api/openstack/v1/__init__.py index c4792ae5..f9d0eb1b 100644 --- a/heat/api/openstack/v1/__init__.py +++ b/heat/api/openstack/v1/__init__.py @@ -71,7 +71,7 @@ class API(wsgi.Router): stack_mapper.connect("stack_lookup", r"/stacks/{stack_name:arn\x3A.*}", action="lookup") - subpaths = ['resources', 'events'] + subpaths = ['resources', 'events', 'template'] path = "{path:%s}" % '|'.join(subpaths) stack_mapper.connect("stack_lookup_subpath", "/stacks/{stack_name}/" + path, diff --git a/heat/tests/test_api_openstack_v1.py b/heat/tests/test_api_openstack_v1.py index 39946fdd..6ed78c45 100644 --- a/heat/tests/test_api_openstack_v1.py +++ b/heat/tests/test_api_openstack_v1.py @@ -1713,6 +1713,8 @@ class RoutesTest(HeatTestCase): 'stack_name': 'teststack', 'stack_id': 'bbbb', }) + + def test_stack_data_template(self): self.assertRoute( self.m, '/aaaa/stacks/teststack/bbbb/template', @@ -1724,6 +1726,17 @@ class RoutesTest(HeatTestCase): 'stack_name': 'teststack', 'stack_id': 'bbbb', }) + self.assertRoute( + self.m, + '/aaaa/stacks/teststack/template', + 'GET', + 'lookup', + 'StackController', + { + 'tenant_id': 'aaaa', + 'stack_name': 'teststack', + 'path': 'template' + }) def test_stack_update_delete(self): self.assertRoute(