summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Hardy <shardy@redhat.com>2017-09-29 09:55:55 +0100
committeryatin <ykarel@redhat.com>2017-10-18 14:54:50 +0000
commit0412b70f52e59f4ceabb643ae0dbdb5994fae5ad (patch)
tree3ef7f6d8f39059a95debee2c0be5e763a953dd5d
parent9d04f0bf0ffcea31e4e51810fde95e276fe24fc2 (diff)
Also match config volumes for /var/lib/config-data/puppet-generated/
Some services only mount this directory, not /var/lib/config-data/$service so handle this case in the docker-puppet code that maps the mounted volumes to the services when adding the config hash to the container environment. Change-Id: I3bdb7609f322458584ac9597ffbfefb057b84646 Closes-Bug: #1720208 (cherry picked from commit 3a932b056914d148fa460b8890fc0e631c817a40)
-rwxr-xr-xdocker/docker-puppet.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/docker/docker-puppet.py b/docker/docker-puppet.py
index cc247031..533ed07d 100755
--- a/docker/docker-puppet.py
+++ b/docker/docker-puppet.py
@@ -90,16 +90,17 @@ def match_config_volume(prefix, config):
config_volume=None
for v in volumes:
if v.startswith(prefix):
- config_volume = os.path.relpath(
- v.split(":")[0], prefix).split("/")[0]
+ config_volume = os.path.dirname(v.split(":")[0])
break
return config_volume
-def get_config_hash(prefix, config_volume):
- hashfile = os.path.join(prefix, "%s.md5sum" % config_volume)
+def get_config_hash(config_volume):
+ hashfile = "%s.md5sum" % config_volume
+ log.debug("Looking for hashfile %s for config_volume %s" % (hashfile, config_volume))
hash_data = None
if os.path.isfile(hashfile):
+ log.debug("Got hashfile %s for config_volume %s" % (hashfile, config_volume))
with open(hashfile) as f:
hash_data = f.read().rstrip()
return hash_data
@@ -248,6 +249,7 @@ def mp_puppet_config((config_volume, puppet_tags, manifest, config_image, volume
# Write a checksum of the config-data dir, this is used as a
# salt to trigger container restart when the config changes
tar -c -f - /var/lib/config-data/${NAME} --mtime='1970-01-01' | md5sum | awk '{print $1}' > /var/lib/config-data/${NAME}.md5sum
+ tar -c -f - /var/lib/config-data/puppet-generated/${NAME} --mtime='1970-01-01' | md5sum | awk '{print $1}' > /var/lib/config-data/puppet-generated/${NAME}.md5sum
fi
""")
@@ -371,7 +373,7 @@ for infile in infiles:
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_prefix, config_volume)
+ config_hash = get_config_hash(config_volume)
if config_hash:
env = v.get('environment', [])
env.append("TRIPLEO_CONFIG_HASH=%s" % config_hash)