Doc: don't generate empty properties fields

Don't create empty properties fields in the resources samples.

This patch will help resolve niceness gates failures when generating the
docbook HOT reference.

Change-Id: I3c74fa583ac55dc0a23520ec07f5d07e3d1b6fab
Closes-Bug: #1360558
This commit is contained in:
Gauvain Pocentek 2014-08-23 10:47:08 +02:00
parent 520234ab0c
commit 0e374945c4
2 changed files with 23 additions and 12 deletions

View File

@ -115,14 +115,17 @@ class ResourcePages(Directive):
props.append('%s: %s' % (prop_key,
self._prop_syntax_example(prop)))
props_str = ''
if props:
props_str = '''\n properties:
%s''' % ('\n '.join(props))
template = '''heat_template_version: 2013-05-23
...
resources:
...
the_resource:
type: %s
properties:
%s''' % (self.resource_type, '\n '.join(props))
type: %s%s''' % (self.resource_type, props_str)
block = nodes.literal_block('', template, language="hot")
section.append(block)
@ -137,14 +140,17 @@ resources:
props.append('%s: %s' % (prop_key,
self._prop_syntax_example(prop)))
props_str = ''
if props:
props_str = '''\n Properties:
%s''' % ('\n '.join(props))
template = '''HeatTemplateFormatVersion: '2012-12-12'
...
Resources:
...
TheResource:
Type: %s
Properties:
%s''' % (self.resource_type, '\n '.join(props))
Type: %s%s''' % (self.resource_type, props_str)
block = nodes.literal_block('', template, language='yaml')
section.append(block)
@ -159,18 +165,23 @@ Resources:
and prop.support_status.status == support.SUPPORTED):
props.append('"%s": %s' % (prop_key,
self._prop_syntax_example(prop)))
props_str = ''
if props:
props_str = ''',\n "Properties": {
%s
}''' % (',\n '.join(props))
template = '''{
"AWSTemplateFormatVersion" : "2010-09-09",
...
"Resources" : {
"TheResource": {
"Type": "%s",
"Properties": {
%s
}
"Type": "%s"%s
}
}
}''' % (self.resource_type, ',\n '.join(props))
}''' % (self.resource_type, props_str)
block = nodes.literal_block('', template, language="json")
section.append(block)

View File

@ -48,7 +48,7 @@ class Volume(resource.Resource):
),
SIZE: properties.Schema(
properties.Schema.INTEGER,
_('The size of the volume in GB. '),
_('The size of the volume in GB.'),
immutable=True,
constraints=[
constraints.Range(min=1),