diff --git a/doc/source/ext/resources.py b/doc/source/ext/resources.py index 607caec7fb..7031e4776b 100644 --- a/doc/source/ext/resources.py +++ b/doc/source/ext/resources.py @@ -255,8 +255,9 @@ resources: definition.append(sub_prop_list) for sub_prop_key, sub_prop in sorted(sub_schema.items(), self.cmp_prop): - self.contribute_property( - sub_prop_list, sub_prop_key, sub_prop) + if sub_prop.support_status.status != support.HIDDEN: + self.contribute_property( + sub_prop_list, sub_prop_key, sub_prop) def contribute_properties(self, parent): if not self.props_schemata: @@ -267,7 +268,8 @@ resources: for prop_key, prop in sorted(self.props_schemata.items(), self.cmp_prop): - self.contribute_property(prop_list, prop_key, prop) + if prop.support_status.status != support.HIDDEN: + self.contribute_property(prop_list, prop_key, prop) def contribute_attributes(self, parent): if not self.attrs_schemata: @@ -276,19 +278,20 @@ resources: prop_list = nodes.definition_list() section.append(prop_list) for prop_key, prop in sorted(self.attrs_schemata.items()): - description = prop.description - prop_item = nodes.definition_list_item( - '', nodes.term('', prop_key)) - prop_list.append(prop_item) + if prop.support_status.status != support.HIDDEN: + description = prop.description + prop_item = nodes.definition_list_item( + '', nodes.term('', prop_key)) + prop_list.append(prop_item) - definition = nodes.definition() - prop_item.append(definition) + definition = nodes.definition() + prop_item.append(definition) - self._status_str(prop.support_status, definition) + self._status_str(prop.support_status, definition) - if description: - def_para = nodes.paragraph('', description) - definition.append(def_para) + if description: + def_para = nodes.paragraph('', description) + definition.append(def_para) def contribute_update_policy(self, parent): if not self.update_policy_schemata: @@ -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: diff --git a/heat/engine/environment.py b/heat/engine/environment.py index 5527078f47..9dc2c080b4 100644 --- a/heat/engine/environment.py +++ b/heat/engine/environment.py @@ -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): diff --git a/heat/engine/service.py b/heat/engine/service.py index f0b7d5c794..e18742db72 100644 --- a/heat/engine/service.py +++ b/heat/engine/service.py @@ -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: diff --git a/heat/engine/support.py b/heat/engine/support.py index 40bf4ba494..68fa27ce8c 100644 --- a/heat/engine/support.py +++ b/heat/engine/support.py @@ -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):