aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorMartin André <m.andre@redhat.com>2017-06-23 18:21:43 +0200
committerMartin André <m.andre@redhat.com>2017-06-28 10:48:53 +0200
commita474ae82d5f157a48c997fb9df420442bd79dcbe (patch)
tree567735ea0e9dbd668b908740dc4526e99ef5a289 /tools
parent8c41b702f5b1c7baf2f2160b92067bcc0267c958 (diff)
Add heat parameter for all of config_volume images
This commit consistently defines a heat template parameter in the form of DockerXXXConfigImage where XXX represents the name of the config_volume that is used by docker-puppet. The goal is to mitigate hard to debug errors where the templates would set different defaults for the image docker-puppet.py uses to run, for the same config_volume name. This fixes a couple of inconsistencies on the way. Change-Id: I212020a76622a03521385a6cae4ce73e51ce5b6b Closes-Bug: #1699791
Diffstat (limited to 'tools')
-rwxr-xr-xtools/yaml-validate.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/tools/yaml-validate.py b/tools/yaml-validate.py
index 396998a0..233ec185 100755
--- a/tools/yaml-validate.py
+++ b/tools/yaml-validate.py
@@ -53,12 +53,22 @@ PARAMETER_DEFINITION_EXCLUSIONS = {'ManagementNetCidr': ['default'],
'StorageMgmtAllocationPools': ['default'],
}
+PREFERRED_CAMEL_CASE = {
+ 'ec2api': 'Ec2Api',
+ 'haproxy': 'HAProxy',
+}
+
def exit_usage():
print('Usage %s <yaml file or directory>' % sys.argv[0])
sys.exit(1)
+def to_camel_case(string):
+ return PREFERRED_CAMEL_CASE.get(string, ''.join(s.capitalize() or '_' for
+ s in string.split('_')))
+
+
def get_base_endpoint_map(filename):
try:
tpl = yaml.load(open(filename).read())
@@ -183,6 +193,13 @@ def validate_docker_service(filename, tpl):
% (key, filename))
return 1
+ config_volume = puppet_config.get('config_volume')
+ expected_config_image_parameter = "Docker%sConfigImage" % to_camel_case(config_volume)
+ if config_volume and not expected_config_image_parameter in tpl.get('parameters', []):
+ print('ERROR: Missing %s heat parameter for %s config_volume.'
+ % (expected_config_image_parameter, config_volume))
+ return 1
+
if 'parameters' in tpl:
for param in required_params:
if param not in tpl['parameters']: