From 53127b3e7242585337733de604aa3e192acbb7e9 Mon Sep 17 00:00:00 2001 From: Steven Hardy Date: Fri, 10 May 2013 17:09:34 +0100 Subject: [PATCH] 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 --- heat/api/openstack/v1/__init__.py | 2 +- heat/tests/test_api_openstack_v1.py | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) 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( -- 2.45.2