Merge "Add HIDDEN status to SupportStatus"

This commit is contained in:
Jenkins 2015-07-16 01:43:10 +00:00 committed by Gerrit Code Review
commit 091ffb167b
4 changed files with 40 additions and 21 deletions

View File

@ -255,6 +255,7 @@ resources:
definition.append(sub_prop_list)
for sub_prop_key, sub_prop in sorted(sub_schema.items(),
self.cmp_prop):
if sub_prop.support_status.status != support.HIDDEN:
self.contribute_property(
sub_prop_list, sub_prop_key, sub_prop)
@ -267,6 +268,7 @@ resources:
for prop_key, prop in sorted(self.props_schemata.items(),
self.cmp_prop):
if prop.support_status.status != support.HIDDEN:
self.contribute_property(prop_list, prop_key, prop)
def contribute_attributes(self, parent):
@ -276,6 +278,7 @@ resources:
prop_list = nodes.definition_list()
section.append(prop_list)
for prop_key, prop in sorted(self.attrs_schemata.items()):
if prop.support_status.status != support.HIDDEN:
description = prop.description
prop_item = nodes.definition_list_item(
'', nodes.term('', prop_key))
@ -326,6 +329,10 @@ class ContribResourcePages(ResourcePages):
def _filter_resources(prefix=None, path=None, statuses=[]):
def not_hidden_match(cls):
return cls.support_status.status != support.HIDDEN
def prefix_match(name):
return prefix is None or name.startswith(prefix)
@ -339,7 +346,8 @@ def _filter_resources(prefix=None, path=None, statuses=[]):
for name in sorted(six.iterkeys(all_resources)):
if prefix_match(name):
for cls in all_resources.get(name):
if path_match(cls) and status_match(cls):
if (path_match(cls) and status_match(cls) and
not_hidden_match(cls)):
if filtered_resources.get(name) is not None:
filtered_resources[name].append(cls)
else:

View File

@ -456,10 +456,14 @@ class ResourceRegistry(object):
return cls.get_class().is_service_available(cnxt)
def not_hidden_matches(cls):
return cls.get_class().support_status.status != support.HIDDEN
return [name for name, cls in six.iteritems(self._registry)
if (is_resource(name) and
status_matches(cls) and
is_available(cls))]
is_available(cls) and
not_hidden_matches(cls))]
class Environment(object):

View File

@ -52,6 +52,7 @@ from heat.engine import service_software_config
from heat.engine import service_stack_watch
from heat.engine import stack as parser
from heat.engine import stack_lock
from heat.engine import support
from heat.engine import template as templatem
from heat.engine import watchrule
from heat.engine import worker
@ -1017,8 +1018,7 @@ class EngineService(service.Service):
return stack_info
def list_resource_types(self, cnxt, support_status=None):
"""
Get a list of supported resource types.
"""Get a list of supported resource types.
:param cnxt: RPC context.
"""
@ -1066,6 +1066,9 @@ class EngineService(service.Service):
exception.TemplateNotFound) as ex:
raise ex
if resource_class.support_status.status == support.HIDDEN:
raise exception.NotSupported(type_name)
def properties_schema():
for name, schema_dict in resource_class.properties_schema.items():
schema = properties.Schema.from_legacy(schema_dict)
@ -1094,8 +1097,11 @@ class EngineService(service.Service):
:param template_type: the template type to generate, cfn or hot.
"""
try:
return resources.global_env().get_class(
type_name).resource_to_template(type_name, template_type)
resource_class = resources.global_env().get_class(type_name)
if resource_class.support_status.status == support.HIDDEN:
raise exception.NotSupported(type_name)
return resource_class.resource_to_template(type_name,
template_type)
except (exception.InvalidResourceType,
exception.ResourceTypeNotFound,
exception.TemplateNotFound) as ex:

View File

@ -13,8 +13,9 @@
from heat.common.i18n import _
SUPPORT_STATUSES = (UNKNOWN, SUPPORTED, DEPRECATED, UNSUPPORTED) = (
'UNKNOWN', 'SUPPORTED', 'DEPRECATED', 'UNSUPPORTED')
SUPPORT_STATUSES = (UNKNOWN, SUPPORTED, DEPRECATED, UNSUPPORTED, HIDDEN
) = ('UNKNOWN', 'SUPPORTED', 'DEPRECATED', 'UNSUPPORTED',
'HIDDEN')
class SupportStatus(object):