Make defaults from roles_data.yaml more robust

The previous logic left out the default Count completely when it was
zero, which breaks nested validation and it's likely similar problems
would exist with the other optional defaults, so rework it so the
defaulting happens in the jinja2 logic, and document the interfaces
better in roles_data.yaml

Change-Id: I7f2eb4a3a0b43c5d2cd0d001ed3c73f783c95c74
Closes-Bug: #1625760
This commit is contained in:
Steven Hardy 2016-09-21 11:10:47 +01:00
parent b40f1dc8c1
commit 1e72333702
2 changed files with 24 additions and 13 deletions

View File

@ -121,16 +121,12 @@ parameters:
resource_registry) which represent nested stacks resource_registry) which represent nested stacks
for each service that should get installed on the {{role.name}} role. for each service that should get installed on the {{role.name}} role.
type: comma_delimited_list type: comma_delimited_list
{% if role.ServicesDefault %} default: {{role.ServicesDefault|default([])}}
default: {{role.ServicesDefault}}
{% endif %}
{{role.name}}Count: {{role.name}}Count:
description: Number of {{role.name}} nodes to deploy description: Number of {{role.name}} nodes to deploy
type: number type: number
{% if role.CountDefault %} default: {{role.CountDefault|default(0)}}
default: {{role.CountDefault}}
{% endif %}
{{role.name}}HostnameFormat: {{role.name}}HostnameFormat:
type: string type: string
@ -140,6 +136,8 @@ parameters:
and %stackname% is replaced with the stack name e.g overcloud and %stackname% is replaced with the stack name e.g overcloud
{% if role.HostnameFormatDefault %} {% if role.HostnameFormatDefault %}
default: "{{role.HostnameFormatDefault}}" default: "{{role.HostnameFormatDefault}}"
{% else %}
default: "%stackname%-{{role.name.lower()}}-%index%"
{% endif %} {% endif %}
{{role.name}}RemovalPolicies: {{role.name}}RemovalPolicies:

View File

@ -1,6 +1,25 @@
# Specifies which roles (groups of nodes) will be deployed
# Note this is used as an input to the various *.j2.yaml
# jinja2 templates, so that they are converted into *.yaml
# during the plan creation (via a mistral action/workflow).
#
# The format is a list, with the following format:
#
# * name: (string) mandatory, name of the role, must be unique
#
# CountDefault: (number) optional, default number of nodes, defaults to 0
# sets the default for the {{role.name}}Count parameter in overcloud.yaml
#
# HostnameFormatDefault: (string) optional default format string for hostname
# defaults to '%stackname%-{{role.name.lower()}}-%index%'
# sets the default for {{role.name}}HostnameFormat parameter in overcloud.yaml
#
# ServicesDefault: (list) optional default list of services to be deployed
# on the role, defaults to an empty list. Sets the default for the
# {{role.name}}Services parameter in overcloud.yaml
- name: Controller - name: Controller
CountDefault: 1 CountDefault: 1
HostnameFormatDefault: '%stackname%-controller-%index%'
ServicesDefault: ServicesDefault:
- OS::TripleO::Services::CACerts - OS::TripleO::Services::CACerts
- OS::TripleO::Services::CephMon - OS::TripleO::Services::CephMon
@ -102,8 +121,6 @@
- OS::TripleO::Services::VipHosts - OS::TripleO::Services::VipHosts
- name: BlockStorage - name: BlockStorage
CountDefault: 0
HostnameFormatDefault: '%stackname%-blockstorage-%index%'
ServicesDefault: ServicesDefault:
- OS::TripleO::Services::CACerts - OS::TripleO::Services::CACerts
- OS::TripleO::Services::CinderVolume - OS::TripleO::Services::CinderVolume
@ -118,8 +135,6 @@
- OS::TripleO::Services::VipHosts - OS::TripleO::Services::VipHosts
- name: ObjectStorage - name: ObjectStorage
CountDefault: 0
HostnameFormatDefault: '%stackname%-objectstorage-%index%'
ServicesDefault: ServicesDefault:
- OS::TripleO::Services::CACerts - OS::TripleO::Services::CACerts
- OS::TripleO::Services::Kernel - OS::TripleO::Services::Kernel
@ -135,8 +150,6 @@
- OS::TripleO::Services::VipHosts - OS::TripleO::Services::VipHosts
- name: CephStorage - name: CephStorage
CountDefault: 0
HostnameFormatDefault: '%stackname%-cephstorage-%index%'
ServicesDefault: ServicesDefault:
- OS::TripleO::Services::CACerts - OS::TripleO::Services::CACerts
- OS::TripleO::Services::CephOSD - OS::TripleO::Services::CephOSD