Merge "Take all mounted config_volumes into account"

This commit is contained in:
Jenkins 2017-10-13 10:10:01 +00:00 committed by Gerrit Code Review
commit 466da79636

View File

@ -83,16 +83,12 @@ def pull_image(name):
log.debug(cmd_stderr)
def match_config_volume(prefix, config):
# Match the mounted config volume - we can't just use the
def match_config_volumes(prefix, config):
# Match the mounted config volumes - we can't just use the
# key as e.g "novacomute" consumes config-data/nova
volumes = config.get('volumes', [])
config_volume = None
for v in volumes:
if v.startswith(prefix):
config_volume = os.path.dirname(v.split(":")[0])
break
return config_volume
return sorted([os.path.dirname(v.split(":")[0]) for v in volumes if
v.startswith(prefix)])
def get_config_hash(config_volume):
@ -374,9 +370,10 @@ for infile in infiles:
infile_data = json.load(f)
for k, v in infile_data.iteritems():
config_volume = match_config_volume(config_volume_prefix, v)
if config_volume:
config_hash = get_config_hash(config_volume)
config_volumes = match_config_volumes(config_volume_prefix, v)
config_hashes = [get_config_hash(volume_path) for volume_path in config_volumes]
config_hashes = filter(None, config_hashes)
config_hash = '-'.join(config_hashes)
if config_hash:
env = v.get('environment', [])
env.append("TRIPLEO_CONFIG_HASH=%s" % config_hash)