Use property support_status in documentation generation
Deprecated properties are now: - sorted at the bottom of the properties list - not included in the syntax examples - include a Note: DEPRECATED - message in the property description Change-Id: Ie3e0a7952a58469342ecdf20e2e325a0709b12f7
This commit is contained in:
parent
457b085648
commit
4d0ccacd51
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
from heat.engine import resources
|
from heat.engine import resources
|
||||||
from heat.engine import properties
|
from heat.engine import properties
|
||||||
|
from heat.engine import support
|
||||||
from heat.openstack.common.gettextutils import _
|
from heat.openstack.common.gettextutils import _
|
||||||
|
|
||||||
from docutils import nodes
|
from docutils import nodes
|
||||||
|
@ -89,7 +90,8 @@ class ResourcePages(Directive):
|
||||||
props = []
|
props = []
|
||||||
for prop_key in sorted(self.props_schemata.keys()):
|
for prop_key in sorted(self.props_schemata.keys()):
|
||||||
prop = self.props_schemata[prop_key]
|
prop = self.props_schemata[prop_key]
|
||||||
if prop.implemented:
|
if (prop.implemented
|
||||||
|
and prop.support_status.status == support.SUPPORTED):
|
||||||
props.append('%s: %s' % (prop_key,
|
props.append('%s: %s' % (prop_key,
|
||||||
self._prop_syntax_example(prop)))
|
self._prop_syntax_example(prop)))
|
||||||
|
|
||||||
|
@ -110,7 +112,8 @@ resources:
|
||||||
props = []
|
props = []
|
||||||
for prop_key in sorted(self.props_schemata.keys()):
|
for prop_key in sorted(self.props_schemata.keys()):
|
||||||
prop = self.props_schemata[prop_key]
|
prop = self.props_schemata[prop_key]
|
||||||
if prop.implemented:
|
if (prop.implemented
|
||||||
|
and prop.support_status.status == support.SUPPORTED):
|
||||||
props.append('%s: %s' % (prop_key,
|
props.append('%s: %s' % (prop_key,
|
||||||
self._prop_syntax_example(prop)))
|
self._prop_syntax_example(prop)))
|
||||||
|
|
||||||
|
@ -132,7 +135,8 @@ Resources:
|
||||||
props = []
|
props = []
|
||||||
for prop_key in sorted(self.props_schemata.keys()):
|
for prop_key in sorted(self.props_schemata.keys()):
|
||||||
prop = self.props_schemata[prop_key]
|
prop = self.props_schemata[prop_key]
|
||||||
if prop.implemented:
|
if (prop.implemented
|
||||||
|
and prop.support_status.status == support.SUPPORTED):
|
||||||
props.append('"%s": %s' % (prop_key,
|
props.append('"%s": %s' % (prop_key,
|
||||||
self._prop_syntax_example(prop)))
|
self._prop_syntax_example(prop)))
|
||||||
template = '''{
|
template = '''{
|
||||||
|
@ -150,6 +154,19 @@ Resources:
|
||||||
block = nodes.literal_block('', template)
|
block = nodes.literal_block('', template)
|
||||||
section.append(block)
|
section.append(block)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def cmp_prop(x, y):
|
||||||
|
x_key, x_prop = x
|
||||||
|
y_key, y_prop = y
|
||||||
|
if x_prop.support_status.status == y_prop.support_status.status:
|
||||||
|
return cmp(x_key, y_key)
|
||||||
|
if x_prop.support_status.status == support.SUPPORTED:
|
||||||
|
return -1
|
||||||
|
if x_prop.support_status.status == support.DEPRECATED:
|
||||||
|
return 1
|
||||||
|
return cmp(x_prop.support_status.status,
|
||||||
|
y_prop.support_status.status)
|
||||||
|
|
||||||
def contribute_property(self, prop_list, prop_key, prop):
|
def contribute_property(self, prop_list, prop_key, prop):
|
||||||
prop_item = nodes.definition_list_item(
|
prop_item = nodes.definition_list_item(
|
||||||
'', nodes.term('', prop_key))
|
'', nodes.term('', prop_key))
|
||||||
|
@ -160,6 +177,13 @@ Resources:
|
||||||
definition = nodes.definition()
|
definition = nodes.definition()
|
||||||
prop_item.append(definition)
|
prop_item.append(definition)
|
||||||
|
|
||||||
|
if prop.support_status.status != support.SUPPORTED:
|
||||||
|
para = nodes.inline(
|
||||||
|
'',
|
||||||
|
_('%(status)s - %(message)s') % prop.support_status.to_dict())
|
||||||
|
warning = nodes.note('', para)
|
||||||
|
definition.append(warning)
|
||||||
|
|
||||||
if not prop.implemented:
|
if not prop.implemented:
|
||||||
para = nodes.inline('', _('Not implemented.'))
|
para = nodes.inline('', _('Not implemented.'))
|
||||||
warning = nodes.note('', para)
|
warning = nodes.note('', para)
|
||||||
|
@ -207,9 +231,10 @@ Resources:
|
||||||
if sub_schema:
|
if sub_schema:
|
||||||
sub_prop_list = nodes.definition_list()
|
sub_prop_list = nodes.definition_list()
|
||||||
definition.append(sub_prop_list)
|
definition.append(sub_prop_list)
|
||||||
for sub_prop_key in sorted(sub_schema.keys()):
|
for sub_prop_key, sub_prop in sorted(sub_schema.items(),
|
||||||
sub_prop = sub_schema[sub_prop_key]
|
self.cmp_prop):
|
||||||
self.contribute_property(sub_prop_list, sub_prop_key, sub_prop)
|
self.contribute_property(
|
||||||
|
sub_prop_list, sub_prop_key, sub_prop)
|
||||||
|
|
||||||
def contribute_properties(self, parent):
|
def contribute_properties(self, parent):
|
||||||
if not self.props_schemata:
|
if not self.props_schemata:
|
||||||
|
@ -217,8 +242,9 @@ Resources:
|
||||||
section = self._section(parent, _('Properties'), '%s-props')
|
section = self._section(parent, _('Properties'), '%s-props')
|
||||||
prop_list = nodes.definition_list()
|
prop_list = nodes.definition_list()
|
||||||
section.append(prop_list)
|
section.append(prop_list)
|
||||||
for prop_key in sorted(self.props_schemata.keys()):
|
|
||||||
prop = self.props_schemata[prop_key]
|
for prop_key, prop in sorted(self.props_schemata.items(),
|
||||||
|
self.cmp_prop):
|
||||||
self.contribute_property(prop_list, prop_key, prop)
|
self.contribute_property(prop_list, prop_key, prop)
|
||||||
|
|
||||||
def contribute_attributes(self, parent):
|
def contribute_attributes(self, parent):
|
||||||
|
|
Loading…
Reference in New Issue