Enhance task execution logic to handle new certificate requests and improve debug output formatting
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
gyurix
2025-05-06 15:55:08 +02:00
parent ee0b103593
commit f9d43d43f9

View File

@@ -803,6 +803,18 @@ execute_task() {
TEMPLATE=$(echo "$TEMPLATE" | base64 -w0) TEMPLATE=$(echo "$TEMPLATE" | base64 -w0)
JSON_TARGET=$(echo '{ "DATE": "'$DATE'", "STATUS": "0", "TEMPLATE": "'$TEMPLATE'" }' | jq -r . | base64 -w0) JSON_TARGET=$(echo '{ "DATE": "'$DATE'", "STATUS": "0", "TEMPLATE": "'$TEMPLATE'" }' | jq -r . | base64 -w0)
elif [ "$TASK_NAME" == "letsencrypt" ]; then
DOMAINS=$(echo $B64_JSON | base64 -d | jq -r 'keys[]')
for DOMAIN in $(echo $DOMAINS); do
REQUEST=$(echo $B64_JSON | base64 -d | jq -r ".[\"$DOMAIN\"].status")
if [ "$REQUEST" == "requested" ]; then
echo "New certificate for $DOMAIN is requested."
touch /etc/system/data/ssl/keys/$DOMAIN/new_certificate
fi
done
elif [ "$DEPLOY_ACTION" == "deploy" ]; then elif [ "$DEPLOY_ACTION" == "deploy" ]; then
JSON_TARGET="" JSON_TARGET=""
#JSON_TARGET=$(echo '{ "DATE": "'$DATE'", "STATUS": "1" }' | jq -r . | base64 -w0) # deployment has started #JSON_TARGET=$(echo '{ "DATE": "'$DATE'", "STATUS": "1" }' | jq -r . | base64 -w0) # deployment has started
@@ -1068,7 +1080,7 @@ inotifywait --exclude "\.(swp|tmp)" -m -e CREATE,CLOSE_WRITE,DELETE,MOVED_TO -r
if [ "${op}" == "CLOSE_WRITE,CLOSE" ]; then if [ "${op}" == "CLOSE_WRITE,CLOSE" ]; then
if [ "$file" != "check_vpn.json" ]; then if [ "$file" != "check_vpn.json" ]; then
echo "new file created: $file" echo "new file created: $file"
fi; fi
B64_JSON=$(cat $DIR/$file | base64 -w0) B64_JSON=$(cat $DIR/$file | base64 -w0)
TASK=$(echo $file | cut -d '.' -f1) TASK=$(echo $file | cut -d '.' -f1)
execute_task "$TASK" "$B64_JSON" execute_task "$TASK" "$B64_JSON"