Browse Source

Merge "Fix generation of TRIPLEO_CONFIG_HASH for services" into stable/stein

changes/12/708012/1
Zuul 6 days ago
parent
commit
ee74f8f396
1 changed files with 17 additions and 2 deletions
  1. +17
    -2
      common/container-puppet.py

+ 17
- 2
common/container-puppet.py View File

@@ -139,6 +139,21 @@ def pull_image(name):
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):
# Match the mounted config volumes - we can't just use the
# key as e.g "novacomute" consumes config-data/nova
@@ -147,8 +162,8 @@ def match_config_volumes(prefix, config):
except AttributeError:
log.error('Error fetching volumes. Prefix: %s - Config: %s' % (prefix, config))
raise
return sorted([os.path.dirname(v.split(":")[0]) for v in volumes if
v.startswith(prefix)])
return sorted([get_config_base(prefix, v.split(":")[0])
for v in volumes if v.startswith(prefix)])


def get_config_hash(config_volume):

Loading…
Cancel
Save