Add name property where missing

All SoftwareDeployment resources should use the name property when using
config-download.

This also adds a validation to check that the name property is set in
yaml-validate.py

Change-Id: I621e282a2e2c041a0701da0296881c615f0bfda4
Closes-Bug: #1733586
This commit is contained in:
James Slagle 2017-11-21 14:48:27 -05:00
parent eeabc17247
commit 7a3fc67559
5 changed files with 29 additions and 0 deletions

View File

@ -42,6 +42,7 @@ resources:
{{role.name}}DeliverUpgradeScriptConfig:
type: OS::Heat::SoftwareConfig
properties:
name: {{role.name}}DeliverUpgradeScriptConfig
group: script
config:
list_join:
@ -59,6 +60,7 @@ resources:
{{role.name}}DeliverUpgradeScriptDeployment:
type: OS::Heat::SoftwareDeploymentGroup
properties:
name: {{role.name}}DeliverUpgradeScriptDeployment
servers: {get_param: [servers, {{role.name}}]}
config: {get_resource: {{role.name}}DeliverUpgradeScriptConfig}
{% endfor %}
@ -120,6 +122,7 @@ resources:
rolling_update:
max_batch_size: {{role.upgrade_batch_size|default(1)}}
properties:
name: {{role.name}}UpgradeBatch_Step{{step}}
servers: {get_param: [servers, {{role.name}}]}
config: {get_resource: {{role.name}}UpgradeBatchConfig_Step{{step}}}
input_values:
@ -164,6 +167,7 @@ resources:
{%- endif %}
{%- endfor %}
properties:
name: {{role.name}}Upgrade_Step{{step}}
servers: {get_param: [servers, {{role.name}}]}
config: {get_resource: {{role.name}}UpgradeConfig_Step{{step}}}
input_values:
@ -216,6 +220,7 @@ resources:
{%- endif %}
{%- endfor %}
properties:
name: {{role.name}}PostUpgradeConfig_Deployment{{step}}
servers: {get_param: [servers, {{role.name}}]}
config: {get_resource: {{role.name}}PostUpgradeConfig_Config{{step}}}
input_values:

View File

@ -35,6 +35,7 @@ resources:
{{role.name}}SwapDeployment:
type: OS::Heat::SoftwareDeploymentGroup
properties:
name: {{role.name}}SwapDeployment
config: {get_resource: SwapConfig}
servers: {get_param: [servers, {{role.name}}]}
input_values:

View File

@ -43,6 +43,7 @@ resources:
{{role.name}}SwapDeployment:
type: OS::Heat::SoftwareDeploymentGroup
properties:
name: {{role.name}}SwapDeployment
config: {get_resource: SwapConfig}
servers: {get_param: [servers, {{role.name}}]}
input_values:

View File

@ -92,11 +92,13 @@ resources:
NetworkMidonetDeploymentControllers:
type: OS::Heat::StructuredDeploymentGroup
properties:
name: NetworkMidonetDeploymentControllers
config: {get_resource: NetworkMidoNetConfig}
servers: {get_param: [servers, Controller]}
NetworkMidonetDeploymentComputes:
type: OS::Heat::StructuredDeploymentGroup
properties:
name: NetworkMidonetDeploymentComputes
config: {get_resource: NetworkMidoNetConfig}
servers: {get_param: [servers, Compute]}

View File

@ -150,6 +150,15 @@ VALIDATE_DOCKER_OVERRIDE = {
# docker/service/sshd.yaml is a variation of the puppet sshd service
'./docker/services/sshd.yaml': False,
}
DEPLOYMENT_RESOURCE_TYPES = [
'OS::Heat::SoftwareDeploymentGroup',
'OS::Heat::StructuredDeploymentGroup',
'OS::Heat::StructuredDeployments',
'OS::Heat::SoftwareDeployments',
'OS::Heat::SoftwareDeployment',
'OS::Heat::StructuredDeployment',
'OS::TripleO::SoftwareDeployment'
]
def exit_usage():
print('Usage %s <yaml file or directory>' % sys.argv[0])
@ -548,6 +557,16 @@ def validate(filename, param_map):
print('Warning: parameter %s in template %s '
'appears to be unused' % (p, filename))
resources = tpl.get('resources')
if resources:
for resource, data in resources.items():
if data['type'] not in DEPLOYMENT_RESOURCE_TYPES:
continue
if 'name' not in data['properties']:
print('ERROR: resource %s from %s missing name property.'
% (resource, filename))
return 1
return retval
def validate_upgrade_tasks(upgrade_steps):
@ -576,6 +595,7 @@ def parse_args():
p.add_argument('--quiet', '-q',
action='count',
default=0,
help='output warnings and errors (-q) or only errors (-qq)')
p.add_argument('path_args',
nargs='*',