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
This commit is contained in:
Thomas Herve 2014-03-10 09:33:13 +01:00
parent c186fa7d28
commit 49dd63f0c6
2 changed files with 8 additions and 5 deletions

View File

@ -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) = \

View File

@ -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")