Browse Source

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

changes/38/704138/1
Zuul Gerrit Code Review 1 month ago
parent
commit
c8c4818b8b
1 changed files with 17 additions and 2 deletions
  1. +17
    -2
      common/container-puppet.py

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

@@ -140,6 +140,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
@@ -148,8 +163,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