Fix generation of TRIPLEO_CONFIG_HASH for services
A container gets a config hash if one of its bind mount references /var/lib/config-data/(puppet-generated)?/service. That hash is created/managed by container-puppet.py and stored in /var/lib/config-data/(puppet-generated)?/service.md5sum Currently, the parsing of bind-mount is broken so container-puppet.py never associates or regenerates config hashes for containers. Fix the parsing to make sure that any bind-mounts starting with /var/lib/config-data always resolve to the right md5sum file. Change-Id: I7ad50d62e6177f109f513c4c11f611be60e570f2 Closes-Bug: #1860364
This commit is contained in:
parent
8e5b072049
commit
a5ffef4a40
|
@ -93,6 +93,21 @@ def pull_image(name):
|
||||||
LOG.debug(stderr)
|
LOG.debug(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
|
||||||
|
@ -106,8 +121,8 @@ def match_config_volumes(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