Browse Source

Add HIDDEN status to SupportStatus

Add HIDDEN status to SupportStatus and it's supporting
in code: hiding objects with HIDDEN status in docs and
resousce-type-list.

bp deprecating-improvements

Change-Id: Iebd77d769966bab321aeaf3e23b7f54e9456ad13
changes/40/186340/11
Peter Razumovsky 7 years ago
parent
commit
6735bece13
  1. 36
      doc/source/ext/resources.py
  2. 6
      heat/engine/environment.py
  3. 14
      heat/engine/service.py
  4. 5
      heat/engine/support.py

36
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:

6
heat/engine/environment.py

@ -457,10 +457,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):

14
heat/engine/service.py

@ -51,6 +51,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
@ -1018,8 +1019,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.
"""
@ -1051,6 +1051,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)
@ -1079,8 +1082,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:

5
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):

Loading…
Cancel
Save