Browse Source

chg: [cron] update for compatibility with new ``$GLOBAL_ALL_RELATION`` var

bgallet/nextcloud
Valentin Lab 2 months ago
parent
commit
a16e34e07c
  1. 29
      cron/lib/common

29
cron/lib/common

@ -201,27 +201,36 @@ cron:lock_opts() {
cron:entries() {
local cache_file="$CACHEDIR/$FUNCNAME.cache.$(H "$SERVICE_NAME" "$ALL_RELATIONS")" \
s rn ts rc td
if [ -z "$SUBSET_ALL_RELATIONS_HASH" ]; then
err "Expected \$SUBSET_ALL_RELATIONS_HASH to be set."
return 1
fi
local cache_file="$CACHEDIR/$FUNCNAME.cache.$(H "$SERVICE_NAME" "$SUBSET_ALL_RELATIONS_HASH")"
local s rn ts rc td E
if [ -e "$cache_file" ]; then
#debug "$FUNCNAME: SESSION cache hit $1"
cat "$cache_file"
return 0
fi
if [ -z "$ALL_RELATIONS" ]; then
err "Expected \$ALL_RELATIONS to be set."
return 1
fi
export TARGET_SERVICE_NAME="$SERVICE_NAME"
while read-0 service relation_cfg; do
while read-0-err E service relation_cfg; do
debug "service: '$service' relation_cfg:" >&2
e "$relation_cfg" | prefix " | " >&2
echo "" >&2
cron:entries_from_service "$service" "$relation_cfg" || return 1
done < <(get_service_incoming_relations "$SERVICE_NAME" "schedule-command") > "$cache_file.tmp"
mv "$cache_file.tmp" "$cache_file" >&2
cron:entries_from_service "$service" "$relation_cfg" || {
err-d "Failed to get entries from service '$service'."
return 1
}
done < <(p-err get_service_incoming_relations "$SERVICE_NAME" "schedule-command") > "$cache_file.tmp"
if [ "$E" != 0 ]; then
rm -f "$cache_file.tmp"
err "Failed to get ${DARKYELLOW}*${NORMAL}--${DARKBLUE}schedule-command${NORMAL}-->${DARKYELLOW}$SERVICE_NAME${NORMAL}'s relations."
return 1
fi
mv "$cache_file"{.tmp,} >&2
cat "$cache_file"
}
export -f cron:entries
Loading…
Cancel
Save