aboutsummaryrefslogtreecommitdiffstats
path: root/tools/yaml-validate.py
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2017-06-29 20:12:59 +0000
committerGerrit Code Review <review@openstack.org>2017-06-29 20:12:59 +0000
commite8d8eae59cf7fac1378ddb6dc78c847abb77c22f (patch)
tree2290212e2b6f529824dc499badfba578a892421b /tools/yaml-validate.py
parent3b7de8a2514cf9b90ee7aec3365bfbf4547175ad (diff)
parenta474ae82d5f157a48c997fb9df420442bd79dcbe (diff)
Merge "Add heat parameter for all of config_volume images"
Diffstat (limited to 'tools/yaml-validate.py')
-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']: