From a474ae82d5f157a48c997fb9df420442bd79dcbe Mon Sep 17 00:00:00 2001 From: Martin André Date: Fri, 23 Jun 2017 18:21:43 +0200 Subject: 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 --- tools/yaml-validate.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'tools') 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 ' % 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']: -- cgit 1.2.3-korg