Commit 3d4f0686 authored by Łukasz Nowak's avatar Łukasz Nowak

caddy-frontend: Avoid bash expansion

There can be a lot of files in the directories leading to Argument list
too long bash error, so switch to method not involving bash expansion.
parent 642e955f
......@@ -22,7 +22,7 @@ md5sum = 5784bea3bd608913769ff9a8afcccb68
[profile-frontend]
filename = instance-frontend.cfg.in
md5sum = ae04e2c6137cb5bd5ef1a9b3c6738c49
md5sum = 65f33cc28372cb7fea61c27b81b6e5f1
[profile-master]
filename = instance-master.cfg.in
......@@ -86,7 +86,7 @@ md5sum = 53e5d7ba2827bff003051f74f24ffe4f
[template-configuration-state-script]
_update_hash_filename_ = templates/configuration-state-script.sh.in
md5sum = 4d2537d2698d32a7e909989f8778d144
md5sum = f494ce78550847066ed5a72c54ef47a9
[template-rotate-script]
_update_hash_filename_ = templates/rotate-script.sh.in
......
......@@ -669,6 +669,8 @@ path_list = ${caddy-configuration:frontend-configuration} ${caddy-directory:slav
sha256sum = {{ software_parameter_dict['sha256sum'] }}
extra-context =
import os_module os
raw find_executable {{ software_parameter_dict['find'] }}
key path_list :path_list
key sha256sum :sha256sum
key signature_file :signature_file
......@@ -832,6 +834,8 @@ path_list = ${backend-haproxy-configuration:file} ${backend-client-login-config:
sha256sum = {{ software_parameter_dict['sha256sum'] }}
extra-context =
import os_module os
raw find_executable {{ software_parameter_dict['find'] }}
key path_list :path_list
key sha256sum :sha256sum
key signature_file :signature_file
......@@ -1001,6 +1005,8 @@ path_list = ${frontend-configuration:slave-introspection-configuration} ${fronte
sha256sum = {{ software_parameter_dict['sha256sum'] }}
extra-context =
import os_module os
raw find_executable {{ software_parameter_dict['find'] }}
key path_list :path_list
key sha256sum :sha256sum
key signature_file :signature_file
......
......@@ -13,6 +13,7 @@ extends =
../../component/numpy/buildout.cfg
../../component/haproxy/buildout.cfg
../../component/nginx/buildout.cfg
../../component/findutils/buildout.cfg
../../stack/caucase/buildout.cfg
......@@ -125,6 +126,7 @@ xz_location = ${xz-utils:location}
htpasswd = ${:bin_directory}/htpasswd
smart_caucase_signer = ${:bin_directory}/smart-caucase-signer
caucase_csr_sign_check = ${:bin_directory}/caucase-csr-sign-check
find = ${findutils:location}/bin/find
[template]
recipe = slapos.recipe.template:jinja2
......
......@@ -5,7 +5,16 @@ SIGNATURE_FILE={{ signature_file }}
NSIGNATURE_FILE={{ signature_file }}.tmp
touch $SIGNATURE_FILE
{{ sha256sum }} {{ path_list }} 2> /dev/null | sort -k 66 > $NSIGNATURE_FILE
rm -f $NSIGNATURE_FILE $NSIGNATURE_FILE.wrk
set +e
{%- for path in path_list.split() %}
{%- set directory = os_module.path.dirname(path) %}
{%- set name = os_module.path.basename(path) %}
{{ find_executable }} {{ directory }} -type f -name '{{ name }}' -exec {{ sha256sum }} {} \; >> $NSIGNATURE_FILE.wrk
{%- endfor %}
set -e
sort -k 66 $NSIGNATURE_FILE.wrk > $NSIGNATURE_FILE
rm -f $NSIGNATURE_FILE.wrk
if diff "$SIGNATURE_FILE" "$NSIGNATURE_FILE" > /dev/null ; then
# No changes since last run just propagate information
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment