Commit 0b8cc5eb authored by Łukasz Nowak's avatar Łukasz Nowak

caddy-frontend: Bugfix validate and graceful scripts

Do not emit needless diff into log.

Do not stop processing in case of validation failure.
parent 4373c643
...@@ -102,11 +102,11 @@ md5sum = ebe5d3d19923eb812a40019cb11276d8 ...@@ -102,11 +102,11 @@ md5sum = ebe5d3d19923eb812a40019cb11276d8
[template-graceful-script] [template-graceful-script]
filename = templates/graceful-script.sh.in filename = templates/graceful-script.sh.in
md5sum = 23fae618a0465b1e6bc46aefa79d9a7e md5sum = 31dd34de4c40a1d814bcbef482c757cc
[template-validate-script] [template-validate-script]
filename = templates/validate-script.sh.in filename = templates/validate-script.sh.in
md5sum = 986681fce5f6dcaa1ee5a05bc55a7e4a md5sum = 4c80ba3727c397f8d5b12cf1888cf959
[caddyprofiledeps-setup] [caddyprofiledeps-setup]
filename = setup.py filename = setup.py
......
...@@ -7,7 +7,7 @@ touch $SIGNATURE_FILE ...@@ -7,7 +7,7 @@ touch $SIGNATURE_FILE
{{ sha256sum }} {{ path_list }} | sort -k 66 > $NSIGNATURE_FILE {{ sha256sum }} {{ path_list }} | sort -k 66 > $NSIGNATURE_FILE
# If no diff, no restart for now # If no diff, no restart for now
if diff "$SIGNATURE_FILE" "$NSIGNATURE_FILE"; then if diff "$SIGNATURE_FILE" "$NSIGNATURE_FILE" > /dev/null ; then
echo "Nothing changed, so nothing to reload" echo "Nothing changed, so nothing to reload"
exit 0 exit 0
fi fi
......
...@@ -9,11 +9,14 @@ SIGNATURE_STATUS={{ signature_file }}.status ...@@ -9,11 +9,14 @@ SIGNATURE_STATUS={{ signature_file }}.status
touch $SIGNATURE_FILE touch $SIGNATURE_FILE
{{ sha256sum }} {{ path_list }} | sort -k 66 > $NSIGNATURE_FILE {{ sha256sum }} {{ path_list }} | sort -k 66 > $NSIGNATURE_FILE
if diff "$SIGNATURE_FILE" "$NSIGNATURE_FILE"; then if diff "$SIGNATURE_FILE" "$NSIGNATURE_FILE" > /dev/null; then
rm -f "$NSIGNATURE_FILE" rm -f "$NSIGNATURE_FILE"
else else
mv "$NSIGNATURE_FILE" "$SIGNATURE_FILE" mv "$NSIGNATURE_FILE" "$SIGNATURE_FILE"
# do not catch errors during validation
set +e
{{ wrapper }} -validate {{ wrapper }} -validate
echo $? > $SIGNATURE_STATUS echo $? > $SIGNATURE_STATUS
set -e
fi fi
exit `cat $SIGNATURE_STATUS` exit `cat $SIGNATURE_STATUS`
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