From 49dd63f0c6a8ec8b2286a393c3bf6cfbe7369049 Mon Sep 17 00:00:00 2001 From: Thomas Herve Date: Mon, 10 Mar 2014 09:33:13 +0100 Subject: [PATCH] Return template based class in list resource types Don't filter out TemplateResourceInfo in ResourceRegistry.get_types so that they are available in the resource-type-list API. Closes-Bug: #1286179 Change-Id: Ie26e3b12e9f05568f146458a0d0c5c120970978b --- heat/engine/environment.py | 12 +++++++----- heat/tests/test_engine_service.py | 1 + 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/heat/engine/environment.py b/heat/engine/environment.py index 2385423a7..0421e7f99 100644 --- a/heat/engine/environment.py +++ b/heat/engine/environment.py @@ -310,15 +310,17 @@ class ResourceRegistry(object): def get_types(self, support_status): '''Return a list of valid resource types.''' - def is_plugin(key): - return isinstance(self._registry[key], ClassResourceInfo) + def is_resource(key): + return isinstance(self._registry[key], (ClassResourceInfo, + TemplateResourceInfo)) def status_matches(cls): - return support_status is None or \ - cls.value.support_status.status == support_status.encode() + return (support_status is None or + cls.get_class().support_status.status == + support_status.encode()) return [name for name, cls in self._registry.iteritems() - if is_plugin(name) and status_matches(cls)] + if is_resource(name) and status_matches(cls)] SECTIONS = (PARAMETERS, RESOURCE_REGISTRY) = \ diff --git a/heat/tests/test_engine_service.py b/heat/tests/test_engine_service.py index a43d2f606..4e663c4de 100644 --- a/heat/tests/test_engine_service.py +++ b/heat/tests/test_engine_service.py @@ -1791,6 +1791,7 @@ class StackServiceTest(HeatTestCase): resources = self.eng.list_resource_types(self.ctx) self.assertIsInstance(resources, list) self.assertIn('AWS::EC2::Instance', resources) + self.assertIn('AWS::RDS::DBInstance', resources) def test_list_resource_types_deprecated(self): resources = self.eng.list_resource_types(self.ctx, "DEPRECATED")