Skip to content

Commit 8882ebf

Browse files
authored
Merge pull request #21 from robertpenberthy/patch-1
Have jq skip over pods without containerStatuses
2 parents a034811 + 428e06c commit 8882ebf

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

check_kubernetes.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ mode_pods() {
367367
for pod in "${pods[@]}"; do
368368
containers=($(echo "$nsdata" | \
369369
jq -r "select(.metadata.name==\"$pod\") | \
370-
.status.containerStatuses[].name"))
370+
.status.containerStatuses[]?.name"))
371371
for container in "${containers[@]}"; do
372372
restart_count=$(echo "$nsdata" | \
373373
jq -r "select(.metadata.name==\"$pod\") | \

0 commit comments

Comments
 (0)