Browse Source

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
changes/92/521992/10
James Slagle 5 years ago
parent
commit
7a3fc67559
  1. 5
      common/major_upgrade_steps.j2.yaml
  2. 1
      extraconfig/all_nodes/swap-partition.j2.yaml
  3. 1
      extraconfig/all_nodes/swap.j2.yaml
  4. 2
      puppet/extraconfig/all_nodes/neutron-midonet-all-nodes.yaml
  5. 20
      tools/yaml-validate.py

5
common/major_upgrade_steps.j2.yaml

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

1
extraconfig/all_nodes/swap-partition.j2.yaml

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

1
extraconfig/all_nodes/swap.j2.yaml

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

2
puppet/extraconfig/all_nodes/neutron-midonet-all-nodes.yaml

@ -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]}

20
tools/yaml-validate.py

@ -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='*',

Loading…
Cancel
Save