mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-09 11:58:16 +00:00
shellcheck: Fix shellcheck SC2145
> Argument mixes string and array. Use * or separate argument. - Swap echos for printfs and improve formatting - Replace $@ with $* - Split arrays into separate arguments Signed-off-by: stevenhorsman <steven@uk.ibm.com>
This commit is contained in:
parent
bc2d7d9e1e
commit
58672068ff
@ -177,7 +177,7 @@ wait_for_app_pods_message() {
|
|||||||
pods=($(oc get pods -l app="$app" --no-headers=true $namespace | awk '{print $1}'))
|
pods=($(oc get pods -l app="$app" --no-headers=true $namespace | awk '{print $1}'))
|
||||||
[ "${#pods}" -ge "$pod_count" ] && break
|
[ "${#pods}" -ge "$pod_count" ] && break
|
||||||
if [ "$SECONDS" -gt "$timeout" ]; then
|
if [ "$SECONDS" -gt "$timeout" ]; then
|
||||||
echo "Unable to find ${pod_count} pods for '-l app=\"$app\"' in ${SECONDS}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
|
||||||
@ -187,7 +187,7 @@ wait_for_app_pods_message() {
|
|||||||
echo "$log" | grep "$message" -q && echo "Found $(echo "$log" | grep "$message") in $pod's log ($SECONDS)" && break;
|
echo "$log" | grep "$message" -q && echo "Found $(echo "$log" | grep "$message") in $pod's log ($SECONDS)" && break;
|
||||||
if [ "$SECONDS" -gt "$timeout" ]; then
|
if [ "$SECONDS" -gt "$timeout" ]; then
|
||||||
echo -n "Message '$message' not present in '${pod}' pod of the '-l app=\"$app\"' "
|
echo -n "Message '$message' not present in '${pod}' pod of the '-l app=\"$app\"' "
|
||||||
echo "pods after ${SECONDS}s (${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
|
||||||
|
@ -96,12 +96,12 @@ function kubectl_retry() {
|
|||||||
local interval=15
|
local interval=15
|
||||||
local i=0
|
local i=0
|
||||||
while true; do
|
while true; do
|
||||||
kubectl $@ && return 0 || true
|
kubectl "$@" && return 0 || true
|
||||||
i=$((i + 1))
|
i=$((i + 1))
|
||||||
[ $i -lt $max_tries ] && echo "'kubectl $@' failed, retrying in $interval seconds" 1>&2 || break
|
[ $i -lt $max_tries ] && echo "'kubectl $*' failed, retrying in $interval seconds" 1>&2 || break
|
||||||
sleep $interval
|
sleep $interval
|
||||||
done
|
done
|
||||||
echo "'kubectl $@' failed after $max_tries tries" 1>&2 && return 1
|
echo "'kubectl $*' failed after $max_tries tries" 1>&2 && return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
function waitForProcess() {
|
function waitForProcess() {
|
||||||
|
@ -297,7 +297,7 @@ check_spans()
|
|||||||
|
|
||||||
# Check for existence of spans in output so we do not do the more
|
# Check for existence of spans in output so we do not do the more
|
||||||
# time consuming test of checking span ordering if it will fail
|
# time consuming test of checking span ordering if it will fail
|
||||||
info "Checking spans: ${span_ordering_data[@]}"
|
info "Checking spans:" "${span_ordering_data[@]}"
|
||||||
local missing_spans=()
|
local missing_spans=()
|
||||||
for span_ordering in "${span_ordering_data[@]}"; do
|
for span_ordering in "${span_ordering_data[@]}"; do
|
||||||
local test_spans=(`echo $span_ordering | tr ':' ' '`)
|
local test_spans=(`echo $span_ordering | tr ':' ' '`)
|
||||||
@ -306,7 +306,7 @@ check_spans()
|
|||||||
done
|
done
|
||||||
done
|
done
|
||||||
if [ "${#missing_spans[@]}" -gt 0 ]; then
|
if [ "${#missing_spans[@]}" -gt 0 ]; then
|
||||||
die "Fail: Missing spans: ${missing_spans[@]}"
|
die "Fail: Missing spans:" "${missing_spans[@]}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check relative ordering of spans. We are not checking full trace, just
|
# Check relative ordering of spans. We are not checking full trace, just
|
||||||
@ -360,10 +360,10 @@ check_spans()
|
|||||||
|
|
||||||
local last_initial_span_index=${#initial_span_ids[@]}-1
|
local last_initial_span_index=${#initial_span_ids[@]}-1
|
||||||
if [ $matches -eq ${#span_ids[@]} ]; then
|
if [ $matches -eq ${#span_ids[@]} ]; then
|
||||||
info "Pass: spans \"${test_spans[@]}\" found in jaeger output"
|
info "Pass: spans \"" "${test_spans[@]}" "\" found in jaeger output"
|
||||||
break
|
break
|
||||||
elif [ $matches -lt ${#span_ids[@]} ] && [ "$initial" = "${initial_span_ids[$last_initial_span_index]}" ]; then
|
elif [ $matches -lt ${#span_ids[@]} ] && [ "$initial" = "${initial_span_ids[$last_initial_span_index]}" ]; then
|
||||||
die "Fail: spans \"${test_spans[@]}\" NOT in jaeger output"
|
die "Fail: spans \"" "${test_spans[@]}" "\" NOT in jaeger output"
|
||||||
fi
|
fi
|
||||||
# else repeat test for next initial span ID
|
# else repeat test for next initial span ID
|
||||||
done
|
done
|
||||||
|
@ -377,7 +377,7 @@ function main(){
|
|||||||
# Verify enough arguments
|
# Verify enough arguments
|
||||||
if [ $# != 2 ] && [ $# != 3 ];then
|
if [ $# != 2 ] && [ $# != 3 ];then
|
||||||
help
|
help
|
||||||
die "Not enough arguments [$@]"
|
die "Not enough arguments [$*]"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${CTR_RUNTIME}" != "io.containerd.runc.v2" ] && [ "${CTR_RUNTIME}" != "io.containerd.kata.v2" ]; then
|
if [ "${CTR_RUNTIME}" != "io.containerd.runc.v2" ] && [ "${CTR_RUNTIME}" != "io.containerd.kata.v2" ]; then
|
||||||
|
@ -106,7 +106,7 @@ EOF
|
|||||||
function main() {
|
function main() {
|
||||||
# Verify enough arguments
|
# Verify enough arguments
|
||||||
if [ $# != 2 ]; then
|
if [ $# != 2 ]; then
|
||||||
echo >&2 "error: Not enough arguments [$@]"
|
echo >&2 "error: Not enough arguments [$*]"
|
||||||
help
|
help
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -111,7 +111,7 @@ EOF
|
|||||||
function main() {
|
function main() {
|
||||||
# Verify enough arguments
|
# Verify enough arguments
|
||||||
if [ $# != 2 ]; then
|
if [ $# != 2 ]; then
|
||||||
echo >&2 "error: Not enough arguments [$@]"
|
echo >&2 "error: Not enough arguments [$*]"
|
||||||
help
|
help
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -151,7 +151,7 @@ EOF
|
|||||||
function main() {
|
function main() {
|
||||||
# Verify enough arguments
|
# Verify enough arguments
|
||||||
if [ "$#" -lt 2 ]; then
|
if [ "$#" -lt 2 ]; then
|
||||||
echo >&2 "error: Not enough arguments [$@]"
|
echo >&2 "error: Not enough arguments [$*]"
|
||||||
help
|
help
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -111,7 +111,7 @@ EOF
|
|||||||
function main() {
|
function main() {
|
||||||
# Verify enough arguments
|
# Verify enough arguments
|
||||||
if [ $# != 2 ]; then
|
if [ $# != 2 ]; then
|
||||||
echo >&2 "error: Not enough arguments [$@]"
|
echo >&2 "error: Not enough arguments [$*]"
|
||||||
help
|
help
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -105,7 +105,7 @@ EOF
|
|||||||
function main() {
|
function main() {
|
||||||
# Verify enough arguments
|
# Verify enough arguments
|
||||||
if [ $# != 2 ]; then
|
if [ $# != 2 ]; then
|
||||||
echo >&2 "error: Not enough arguments [$@]"
|
echo >&2 "error: Not enough arguments [$*]"
|
||||||
help
|
help
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -140,7 +140,7 @@ EOF
|
|||||||
function main() {
|
function main() {
|
||||||
# Verify enough arguments
|
# Verify enough arguments
|
||||||
if [ $# != 1 ]; then
|
if [ $# != 1 ]; then
|
||||||
echo >&2 "error: Not enough arguments [$@]"
|
echo >&2 "error: Not enough arguments [$*]"
|
||||||
help
|
help
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -30,7 +30,7 @@ EOF
|
|||||||
function main() {
|
function main() {
|
||||||
# Verify enough arguments
|
# Verify enough arguments
|
||||||
if [ $# != 2 ]; then
|
if [ $# != 2 ]; then
|
||||||
echo >&2 "error: Not enough arguments [$@]"
|
echo >&2 "error: Not enough arguments [$*]"
|
||||||
help
|
help
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -273,8 +273,8 @@ get_test_config() {
|
|||||||
local config="${script_dir}/${distro}/config.sh"
|
local config="${script_dir}/${distro}/config.sh"
|
||||||
source ${config}
|
source ${config}
|
||||||
|
|
||||||
echo -e "INIT_PROCESS:\t\t$INIT_PROCESS"
|
printf "INIT_PROCESS:\t\t%s\n" "${INIT_PROCESS:-}"
|
||||||
echo -e "ARCH_EXCLUDE_LIST:\t\t${ARCH_EXCLUDE_LIST[@]}"
|
printf "ARCH_EXCLUDE_LIST:\t\t%s\n" "${ARCH_EXCLUDE_LIST[@]:-}"
|
||||||
}
|
}
|
||||||
|
|
||||||
check_function_exist()
|
check_function_exist()
|
||||||
|
Loading…
Reference in New Issue
Block a user