mirror of
https://github.com/mag37/dockcheck.git
synced 2026-02-14 23:38:15 +01:00
fixes for odd unbound variables
This commit is contained in:
parent
710cbc118f
commit
3a8571c625
1 changed files with 6 additions and 6 deletions
12
dockcheck.sh
12
dockcheck.sh
|
|
@ -413,14 +413,14 @@ done < <( \
|
|||
|
||||
# Sort arrays alphabetically
|
||||
IFS=$'\n'
|
||||
NoUpdates=($(sort <<<"${NoUpdates[*]}"))
|
||||
GotUpdates=($(sort <<<"${GotUpdates[*]}"))
|
||||
NoUpdates=($(sort <<<"${NoUpdates[*]:-}"))
|
||||
GotUpdates=($(sort <<<"${GotUpdates[*]:-}"))
|
||||
unset IFS
|
||||
|
||||
# Run the prometheus exporter function
|
||||
if [[ -n "${CollectorTextFileDirectory:-}" ]]; then
|
||||
if type -t send_notification &>/dev/null; then
|
||||
prometheus_exporter ${#NoUpdates[@]} ${#GotUpdates[@]} ${#GotErrors[@]}
|
||||
prometheus_exporter ${#NoUpdates[@]:-} ${#GotUpdates[@]:-} ${#GotErrors[@]:-}
|
||||
else
|
||||
printf "%s\n" "Could not source prometheus exporter function."
|
||||
fi
|
||||
|
|
@ -430,16 +430,16 @@ fi
|
|||
UpdCount="${#GotUpdates[@]}"
|
||||
|
||||
# List what containers got updates or not
|
||||
if [[ -n ${NoUpdates[*]} ]]; then
|
||||
if [[ -n ${NoUpdates[*]:-} ]]; then
|
||||
printf "\n%bContainers on latest version:%b\n" "$c_green" "$c_reset"
|
||||
printf "%s\n" "${NoUpdates[@]}"
|
||||
fi
|
||||
if [[ -n ${GotErrors[*]} ]]; then
|
||||
if [[ -n ${GotErrors[*]:-} ]]; then
|
||||
printf "\n%bContainers with errors, won't get updated:%b\n" "$c_red" "$c_reset"
|
||||
printf "%s\n" "${GotErrors[@]}"
|
||||
printf "%binfo:%b 'unauthorized' often means not found in a public registry.\n" "$c_blue" "$c_reset"
|
||||
fi
|
||||
if [[ -n ${GotUpdates[*]} ]]; then
|
||||
if [[ -n ${GotUpdates[*]:-} ]]; then
|
||||
printf "\n%bContainers with updates available:%b\n" "$c_yellow" "$c_reset"
|
||||
[[ "$AutoMode" == false ]] && options || printf "%s\n" "${GotUpdates[@]}"
|
||||
[[ "$Notify" == true ]] && { type -t send_notification &>/dev/null && send_notification "${GotUpdates[@]}" || printf "Could not source notification function.\n"; }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue