Compare commits
2 commits
345316947b
...
6f05b7b547
Author | SHA1 | Date | |
---|---|---|---|
6f05b7b547 | |||
3eb5c10e0b |
1 changed files with 8 additions and 9 deletions
|
@ -89,7 +89,6 @@ function rebuild_status_file() {
|
||||||
[[ -z "$REBUILD_STATUS_FILE" ]] && \
|
[[ -z "$REBUILD_STATUS_FILE" ]] && \
|
||||||
REBUILD_STATUS_FILE="$REBUILD_DATA_DIR/status.json"
|
REBUILD_STATUS_FILE="$REBUILD_DATA_DIR/status.json"
|
||||||
[[ -e "$REBUILD_STATUS_FILE" ]] || echo '{}' > "$REBUILD_STATUS_FILE"
|
[[ -e "$REBUILD_STATUS_FILE" ]] || echo '{}' > "$REBUILD_STATUS_FILE"
|
||||||
echo "$REBUILD_STATUS_FILE"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function rebuild_status() {
|
function rebuild_status() {
|
||||||
|
@ -99,7 +98,7 @@ function rebuild_status() {
|
||||||
declare -g "$output_var=$( cat "$REBUILD_STATUS_FILE" )"
|
declare -g "$output_var=$( cat "$REBUILD_STATUS_FILE" )"
|
||||||
else
|
else
|
||||||
declare -g "$output_var=$(
|
declare -g "$output_var=$(
|
||||||
jq -r --arg container "$1" '.[$container]' < "$REBUILD_STATUS_FILE"
|
jq -r --arg container "$2" '.[$container]' < "$REBUILD_STATUS_FILE"
|
||||||
)"
|
)"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -115,17 +114,17 @@ function update_rebuild_status() {
|
||||||
'del(.[$container])' <<< "$DATA"
|
'del(.[$container])' <<< "$DATA"
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
local args=( --arg container "$1" ) arg name value expr=( )
|
local args=( --arg container "$1" ) arg name value exp=( )
|
||||||
for arg in "${@:2}"; do
|
for arg in "${@:2}"; do
|
||||||
name=$( cut -d'=' -f1 <<< "$arg" )
|
name=$( head -n 1 <<< "$arg" | cut -d'=' -f1 )
|
||||||
# shellcheck disable=SC2001
|
# shellcheck disable=SC2001
|
||||||
value=$( sed 's/[^=]\+=//' <<< "$arg" )
|
value=$( sed "s/$name=//" <<< "$arg" )
|
||||||
args+=( --arg "$name" "$value" )
|
args+=( --arg "$name" "$value" )
|
||||||
expr+=( ".[\$container].$name=\$$name" )
|
exp+=( ".[\$container].${name}=\$${name}" )
|
||||||
done
|
done
|
||||||
rebuild_status DATA
|
rebuild_status DATA
|
||||||
data=$(
|
data=$(
|
||||||
jq "${args[@]}" "$( implode ' | ' "${expr[@]}" )" <<< "$DATA"
|
jq "${args[@]}" "$( implode ' | ' "${exp[@]}" )" <<< "$DATA"
|
||||||
)
|
)
|
||||||
fi
|
fi
|
||||||
cat <<< "$data" > "$REBUILD_STATUS_FILE"
|
cat <<< "$data" > "$REBUILD_STATUS_FILE"
|
||||||
|
@ -494,10 +493,10 @@ if [[ $REBUILD -eq 1 ]]; then
|
||||||
REBUILT_CONTAINERS=()
|
REBUILT_CONTAINERS=()
|
||||||
for container in "${!UPGRADABLE_CONTAINERS[@]}"; do
|
for container in "${!UPGRADABLE_CONTAINERS[@]}"; do
|
||||||
need_rebuild=0
|
need_rebuild=0
|
||||||
rebuild_status "$container" CONTAINER_DATA
|
rebuild_status CONTAINER_DATA "$container"
|
||||||
# shellcheck disable=SC2153
|
# shellcheck disable=SC2153
|
||||||
if [[ "$CONTAINER_DATA" != "null" ]]; then
|
if [[ "$CONTAINER_DATA" != "null" ]]; then
|
||||||
debug "$container: data=$CONTAINER_DATA"
|
debug "$container: data='$CONTAINER_DATA'"
|
||||||
trigger_date=$( jq -r .trigger_date <<< "$CONTAINER_DATA" )
|
trigger_date=$( jq -r .trigger_date <<< "$CONTAINER_DATA" )
|
||||||
start_date=$( jq -r .start_date <<< "$CONTAINER_DATA" )
|
start_date=$( jq -r .start_date <<< "$CONTAINER_DATA" )
|
||||||
end_date=$( jq -r .end_date <<< "$CONTAINER_DATA" )
|
end_date=$( jq -r .end_date <<< "$CONTAINER_DATA" )
|
||||||
|
|
Loading…
Reference in a new issue