mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-27 11:31:05 +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}" -ge "$pod_count" ] && break
|
||||
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
|
||||
fi
|
||||
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;
|
||||
if [ "$SECONDS" -gt "$timeout" ]; then
|
||||
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 "$log"
|
||||
return -1
|
||||
|
@ -96,12 +96,12 @@ function kubectl_retry() {
|
||||
local interval=15
|
||||
local i=0
|
||||
while true; do
|
||||
kubectl $@ && return 0 || true
|
||||
kubectl "$@" && return 0 || true
|
||||
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
|
||||
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() {
|
||||
@ -601,7 +601,7 @@ function clone_cri_containerd() {
|
||||
# version: the version of the tarball that will be downloaded
|
||||
# tarball-name: the name of the tarball that will be downloaded
|
||||
function download_github_project_tarball() {
|
||||
project="${1}"
|
||||
project="${1}"
|
||||
version="${2}"
|
||||
tarball_name="${3}"
|
||||
|
||||
@ -731,7 +731,7 @@ OOMScoreAdjust=-999
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# base_version: The version to be intalled in the ${major}.${minor} format
|
||||
|
@ -297,7 +297,7 @@ check_spans()
|
||||
|
||||
# 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
|
||||
info "Checking spans: ${span_ordering_data[@]}"
|
||||
info "Checking spans:" "${span_ordering_data[@]}"
|
||||
local missing_spans=()
|
||||
for span_ordering in "${span_ordering_data[@]}"; do
|
||||
local test_spans=(`echo $span_ordering | tr ':' ' '`)
|
||||
@ -306,7 +306,7 @@ check_spans()
|
||||
done
|
||||
done
|
||||
if [ "${#missing_spans[@]}" -gt 0 ]; then
|
||||
die "Fail: Missing spans: ${missing_spans[@]}"
|
||||
die "Fail: Missing spans:" "${missing_spans[@]}"
|
||||
fi
|
||||
|
||||
# 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
|
||||
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
|
||||
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
|
||||
# else repeat test for next initial span ID
|
||||
done
|
||||
|
@ -377,7 +377,7 @@ function main(){
|
||||
# Verify enough arguments
|
||||
if [ $# != 2 ] && [ $# != 3 ];then
|
||||
help
|
||||
die "Not enough arguments [$@]"
|
||||
die "Not enough arguments [$*]"
|
||||
fi
|
||||
|
||||
if [ "${CTR_RUNTIME}" != "io.containerd.runc.v2" ] && [ "${CTR_RUNTIME}" != "io.containerd.kata.v2" ]; then
|
||||
|
@ -106,7 +106,7 @@ EOF
|
||||
function main() {
|
||||
# Verify enough arguments
|
||||
if [ $# != 2 ]; then
|
||||
echo >&2 "error: Not enough arguments [$@]"
|
||||
echo >&2 "error: Not enough arguments [$*]"
|
||||
help
|
||||
exit 1
|
||||
fi
|
||||
|
@ -111,7 +111,7 @@ EOF
|
||||
function main() {
|
||||
# Verify enough arguments
|
||||
if [ $# != 2 ]; then
|
||||
echo >&2 "error: Not enough arguments [$@]"
|
||||
echo >&2 "error: Not enough arguments [$*]"
|
||||
help
|
||||
exit 1
|
||||
fi
|
||||
|
@ -151,7 +151,7 @@ EOF
|
||||
function main() {
|
||||
# Verify enough arguments
|
||||
if [ "$#" -lt 2 ]; then
|
||||
echo >&2 "error: Not enough arguments [$@]"
|
||||
echo >&2 "error: Not enough arguments [$*]"
|
||||
help
|
||||
exit 1
|
||||
fi
|
||||
|
@ -111,7 +111,7 @@ EOF
|
||||
function main() {
|
||||
# Verify enough arguments
|
||||
if [ $# != 2 ]; then
|
||||
echo >&2 "error: Not enough arguments [$@]"
|
||||
echo >&2 "error: Not enough arguments [$*]"
|
||||
help
|
||||
exit 1
|
||||
fi
|
||||
|
@ -105,7 +105,7 @@ EOF
|
||||
function main() {
|
||||
# Verify enough arguments
|
||||
if [ $# != 2 ]; then
|
||||
echo >&2 "error: Not enough arguments [$@]"
|
||||
echo >&2 "error: Not enough arguments [$*]"
|
||||
help
|
||||
exit 1
|
||||
fi
|
||||
|
@ -140,7 +140,7 @@ EOF
|
||||
function main() {
|
||||
# Verify enough arguments
|
||||
if [ $# != 1 ]; then
|
||||
echo >&2 "error: Not enough arguments [$@]"
|
||||
echo >&2 "error: Not enough arguments [$*]"
|
||||
help
|
||||
exit 1
|
||||
fi
|
||||
|
@ -30,7 +30,7 @@ EOF
|
||||
function main() {
|
||||
# Verify enough arguments
|
||||
if [ $# != 2 ]; then
|
||||
echo >&2 "error: Not enough arguments [$@]"
|
||||
echo >&2 "error: Not enough arguments [$*]"
|
||||
help
|
||||
exit 1
|
||||
fi
|
||||
|
@ -273,8 +273,8 @@ get_test_config() {
|
||||
local config="${script_dir}/${distro}/config.sh"
|
||||
source ${config}
|
||||
|
||||
echo -e "INIT_PROCESS:\t\t$INIT_PROCESS"
|
||||
echo -e "ARCH_EXCLUDE_LIST:\t\t${ARCH_EXCLUDE_LIST[@]}"
|
||||
printf "INIT_PROCESS:\t\t%s\n" "${INIT_PROCESS:-}"
|
||||
printf "ARCH_EXCLUDE_LIST:\t\t%s\n" "${ARCH_EXCLUDE_LIST[@]:-}"
|
||||
}
|
||||
|
||||
check_function_exist()
|
||||
|
Loading…
Reference in New Issue
Block a user