]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
api : Fix template-show partial URL redirect
authorSteven Hardy <shardy@redhat.com>
Fri, 10 May 2013 16:09:34 +0000 (17:09 +0100)
committerSteven Hardy <shardy@redhat.com>
Mon, 13 May 2013 11:10:17 +0000 (12:10 +0100)
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
heat/tests/test_api_openstack_v1.py

index c4792ae5c07db793af68b569167c373dd3d9b5d9..f9d0eb1b6e513ce08bb20afb775aed8409e1d398 100644 (file)
@@ -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,
index 39946fdd63a9758bd3cb32e390431cdb19d736aa..6ed78c45b81ec71d2ffff47ef6fc82e51e1d9fde 100644 (file)
@@ -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(