Merge "Fix generation of TRIPLEO_CONFIG_HASH for services" into stable/train
This commit is contained in:
commit
c8c4818b8b
|
@ -140,6 +140,21 @@ def pull_image(name):
|
||||||
log.debug(cmd_stderr)
|
log.debug(cmd_stderr)
|
||||||
|
|
||||||
|
|
||||||
|
def get_config_base(prefix, volume):
|
||||||
|
# crawl the volume's path upwards until we find the
|
||||||
|
# volume's base, where the hashed config file resides
|
||||||
|
path = volume
|
||||||
|
base = prefix.rstrip(os.path.sep)
|
||||||
|
base_generated = os.path.join(base, 'puppet-generated')
|
||||||
|
while path.startswith(prefix):
|
||||||
|
dirname = os.path.dirname(path)
|
||||||
|
if dirname == base or dirname == base_generated:
|
||||||
|
return path
|
||||||
|
else:
|
||||||
|
path = dirname
|
||||||
|
raise ValueError("Could not find config's base for '%s'" % volume)
|
||||||
|
|
||||||
|
|
||||||
def match_config_volumes(prefix, config):
|
def match_config_volumes(prefix, config):
|
||||||
# Match the mounted config volumes - we can't just use the
|
# Match the mounted config volumes - we can't just use the
|
||||||
# key as e.g "novacomute" consumes config-data/nova
|
# key as e.g "novacomute" consumes config-data/nova
|
||||||
|
@ -148,8 +163,8 @@ def match_config_volumes(prefix, config):
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
log.error('Error fetching volumes. Prefix: %s - Config: %s' % (prefix, config))
|
log.error('Error fetching volumes. Prefix: %s - Config: %s' % (prefix, config))
|
||||||
raise
|
raise
|
||||||
return sorted([os.path.dirname(v.split(":")[0]) for v in volumes if
|
return sorted([get_config_base(prefix, v.split(":")[0])
|
||||||
v.startswith(prefix)])
|
for v in volumes if v.startswith(prefix)])
|
||||||
|
|
||||||
|
|
||||||
def get_config_hash(config_volume):
|
def get_config_hash(config_volume):
|
||||||
|
|
Loading…
Reference in New Issue