From 4e151424115ba6d1e4eb03ae125a112afa855799 Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Tue, 24 Aug 2021 23:24:42 -0700 Subject: [PATCH] Fix another null exit case (#43) --- hooks/command | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hooks/command b/hooks/command index d0b0342..81dc10c 100755 --- a/hooks/command +++ b/hooks/command @@ -214,7 +214,9 @@ else echo "Warning: init container failed with exit code $init_container_status, this usually indicates plugin misconfiguration or infrastructure failure" status="$init_container_status" else - status="$(echo "$pod_json" | jq ".status.containerStatuses[0].state.terminated.exitCode")" + if container_status="$(echo "$pod_json" | jq -e ".status.containerStatuses[0].state.terminated.exitCode")"; then + status=$container_status + fi fi elif [[ "$pod_json" == *NotFound* ]]; then echo "Warning: pod not found"