diff --git a/extras/errorCheck.sh b/extras/errorCheck.sh index 99f0950..c968a8a 100755 --- a/extras/errorCheck.sh +++ b/extras/errorCheck.sh @@ -2,15 +2,24 @@ SearchName="$1" for i in $(podman ps --filter "name=$SearchName" --format '{{.Names}}') ; do echo "------------ $i ------------" - ContPath=$(podman inspect "$i" --format '{{ index .Config.Labels "com.docker.compose.project.working_dir" }}') + ContLabels=$(podman inspect "$i" --format '{{json .Config.Labels}}') + ContImage=$(podman inspect "$i" --format='{{.ImageName}}') + ContPath=$(jq -r '."com.docker.compose.project.working_dir"' <<< "$ContLabels") + [ "$ContPath" == "null" ] && ContPath="" if [ -z "$ContPath" ]; then echo "$i has no compose labels - skipping" continue fi - ContConfigFile=$(podman inspect "$i" --format '{{ index .Config.Labels "com.docker.compose.project.config_files" }}') - ContName=$(podman inspect "$i" --format '{{ index .Config.Labels "com.docker.compose.service" }}') - ContEnv=$(podman inspect "$i" --format '{{ index .Config.Labels "com.docker.compose.project.environment_file" }}') - ContImage=$(podman inspect "$i" --format='{{.ImageName}}') + ContConfigFile=$(jq -r '."com.docker.compose.project.config_files"' <<< "$ContLabels") + [ "$ContConfigFile" == "null" ] && ContConfigFile="" + ContName=$(jq -r '."com.docker.compose.service"' <<< "$ContLabels") + [ "$ContName" == "null" ] && ContName="" + ContEnv=$(jq -r '."com.docker.compose.project.environment_file"' <<< "$ContLabels") + [ "$ContEnv" == "null" ] && ContEnv="" + ContUpdateLabel=$(jq -r '."sudo-kraken.podcheck.update"' <<< "$ContLabels") + [ "$ContUpdateLabel" == "null" ] && ContUpdateLabel="" + ContRestartStack=$(jq -r '."sudo-kraken.podcheck.restart-stack"' <<< "$ContLabels") + [ "$ContRestartStack" == "null" ] && ContRestartStack="" if [[ $ContConfigFile = '/'* ]] ; then ComposeFile="$ContConfigFile" @@ -23,6 +32,8 @@ for i in $(podman ps --filter "name=$SearchName" --format '{{.Names}}') ; do echo -e "Compose files:\t\t$ComposeFile" echo -e "Environment files:\t$ContEnv" echo -e "Container image:\t$ContImage" + echo -e "Update label:\t$ContUpdateLabel" + echo -e "Restart Stack label:\t$ContRestartStack" echo echo "Mounts:" podman inspect -f '{{ range .Mounts }}{{ .Source }}:{{ .Destination }}{{ printf "\n" }}{{ end }}' "$i" diff --git a/podcheck.sh b/podcheck.sh index 35c210d..9161340 100644 --- a/podcheck.sh +++ b/podcheck.sh @@ -296,24 +296,18 @@ if [ -n "$GotUpdates" ] ; then unset CompleteConfs # Extract labels and metadata ContLabels=$(podman inspect "$i" --format '{{json .Config.Labels}}') - ContPath=$(echo "$ContLabels" | jq -r '."com.docker.compose.project.working_dir"') - [ "$ContPath" == "null" ] && ContPath="" - - ContConfigFile=$(echo "$ContLabels" | jq -r '."com.docker.compose.project.config_files"') - [ "$ContConfigFile" == "null" ] && ContConfigFile="" - - ContName=$(echo "$ContLabels" | jq -r '."com.docker.compose.service"') - [ "$ContName" == "null" ] && ContName="" - - ContEnv=$(echo "$ContLabels" | jq -r '."com.docker.compose.project.environment_file"') - [ "$ContEnv" == "null" ] && ContEnv="" - ContImage=$(podman inspect "$i" --format='{{.ImageName}}') - - ContUpdateLabel=$(echo "$ContLabels" | jq -r '."sudo-kraken.podcheck.update"') + ContPath=$(jq -r '."com.docker.compose.project.working_dir"' <<< "$ContLabels") + [ "$ContPath" == "null" ] && ContPath="" + ContConfigFile=$(jq -r '."com.docker.compose.project.config_files"' <<< "$ContLabels") + [ "$ContConfigFile" == "null" ] && ContConfigFile="" + ContName=$(jq -r '."com.docker.compose.service"' <<< "$ContLabels") + [ "$ContName" == "null" ] && ContName="" + ContEnv=$(jq -r '."com.docker.compose.project.environment_file"' <<< "$ContLabels") + [ "$ContEnv" == "null" ] && ContEnv="" + ContUpdateLabel=$(jq -r '."sudo-kraken.podcheck.update"' <<< "$ContLabels") [ "$ContUpdateLabel" == "null" ] && ContUpdateLabel="" - - ContRestartStack=$(echo "$ContLabels" | jq -r '."sudo-kraken.podcheck.restart-stack"') + ContRestartStack=$(jq -r '."sudo-kraken.podcheck.restart-stack"' <<< "$ContLabels") [ "$ContRestartStack" == "null" ] && ContRestartStack="" # Checking if compose-values are empty - possibly started with podman run or managed by Quadlet