Merge "Return template based class in list resource types"

This commit is contained in:
Jenkins 2014-03-13 23:59:24 +00:00 committed by Gerrit Code Review
commit 4a8cae5e28
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")