Fix TRIPLEO_CONFIG_HASH generation

There are times when there is no newline char at the end of files
that are used to a generate config hash. This is will result in
header lines with datetimestamp getting appended to the previous
line and not filtered. So, container-puppet.py would generate a
different TRIPLEO_CONFIG_HASH for services every time.

Ex. When using custom policies it would append puppet generated line
from cron config with timestamp to the last line from policy.json.
This would result in new config hash for every deployment and
containers getting replaced.

Resolves: rhbz#2083016
Change-Id: I2153844ed06756eeb9ff56cfff64908bed5fa577
This commit is contained in:
Rabi Mishra 2022-08-05 13:39:30 +05:30
parent b36d30e898
commit 7d64dd990a
1 changed files with 2 additions and 2 deletions

View File

@ -176,7 +176,7 @@ if [ -z "$NO_ARCHIVE" ]; then
# needed because puppet puts timestamps as comments in cron and
# parsedfile resources, hence triggering a change at every redeploy
tar -c --mtime='1970-01-01' $EXCLUDE -f - ${conf_data_path} $additional_checksum_files | tar xO | \
sed '/^#.*HEADER.*/d' | md5sum | awk '{print $1}' > ${conf_data_path}.md5sum
sed '/^#.*HEADER.*/d; s/\#.HEADER.*//g' | md5sum | awk '{print $1}' > ${conf_data_path}.md5sum
tar -c --mtime='1970-01-01' $EXCLUDE -f - ${puppet_generated_path} $additional_checksum_files --mtime='1970-01-01' | tar xO \
| sed '/^#.*HEADER.*/d' | md5sum | awk '{print $1}' > ${puppet_generated_path}.md5sum
| sed '/^#.*HEADER.*/d; s/\#.HEADER.*//g' | md5sum | awk '{print $1}' > ${puppet_generated_path}.md5sum
fi