shellcheck: Fix shellcheck SC2242

> Can only exit with status 0-255. Other data should be written to stdout/stderr.

Switch exit -1 to exit 1

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
This commit is contained in:
stevenhorsman 2025-02-28 11:43:54 +00:00
parent ed8347c868
commit 67bfd4793e
3 changed files with 5 additions and 6 deletions

View File

@ -52,8 +52,7 @@ echo "Wait for all related pods to be gone"
oc get pods -l name="kubelet-kata-cleanup" --no-headers=true -n kube-system 2>&1 | grep "No resources found" -q && ((repeats++)) || repeats=1 oc get pods -l name="kubelet-kata-cleanup" --no-headers=true -n kube-system 2>&1 | grep "No resources found" -q && ((repeats++)) || repeats=1
[ "$repeats" -gt 5 ] && echo kata-cleanup finished && break [ "$repeats" -gt 5 ] && echo kata-cleanup finished && break
sleep 1 sleep 1
done) || { echo "There are still some kata-cleanup related pods after 600 iterations"; oc get all -n kube-system; exit -1; } done) || { echo "There are still some kata-cleanup related pods after 600 iterations"; oc get all -n kube-system; exit 1; }
oc delete -f kata-cleanup/base/kata-cleanup.yaml oc delete -f kata-cleanup/base/kata-cleanup.yaml
oc delete -f kata-rbac/base/kata-rbac.yaml oc delete -f kata-rbac/base/kata-rbac.yaml
oc delete -f runtimeclasses/kata-runtimeClasses.yaml oc delete -f runtimeclasses/kata-runtimeClasses.yaml

View File

@ -178,7 +178,7 @@ wait_for_app_pods_message() {
[ "${#pods}" -ge "$pod_count" ] && break [ "${#pods}" -ge "$pod_count" ] && break
if [ "$SECONDS" -gt "$timeout" ]; then if [ "$SECONDS" -gt "$timeout" ]; then
printf "Unable to find ${pod_count} pods for '-l app=\"$app\"' in ${SECONDS}s (%s)" "${pods[@]}" printf "Unable to find ${pod_count} pods for '-l app=\"$app\"' in ${SECONDS}s (%s)" "${pods[@]}"
return -1 return 1
fi fi
done done
for pod in "${pods[@]}"; do for pod in "${pods[@]}"; do
@ -190,7 +190,7 @@ wait_for_app_pods_message() {
printf "pods after ${SECONDS}s :(%s)\n" "${pods[@]}" printf "pods after ${SECONDS}s :(%s)\n" "${pods[@]}"
echo "Pod $pod's output so far:" echo "Pod $pod's output so far:"
echo "$log" echo "$log"
return -1 return 1
fi fi
sleep 1; sleep 1;
done done

View File

@ -137,7 +137,7 @@ main()
if [ -z "${check_in_container}" ]; then if [ -z "${check_in_container}" ]; then
echo "Error: 'OUTPUT_DIR' not set" >&2 echo "Error: 'OUTPUT_DIR' not set" >&2
echo "$0 should be run using the Dockerfile supplied." >&2 echo "$0 should be run using the Dockerfile supplied." >&2
exit -1 exit 1
fi fi
local OPTIND local OPTIND
@ -154,7 +154,7 @@ main()
# parse failure # parse failure
help help
echo "ERROR: Failed to parse arguments" echo "ERROR: Failed to parse arguments"
exit -1 exit 1
;; ;;
esac esac
done done