Skip to content

Commit 9cda80e

Browse files
committed
fix shellcheck lint errors in cluster and hack scripts
1 parent 0133d14 commit 9cda80e

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

cluster/gce/gci/node-helper.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,13 @@ function get-node-instance-metadata-from-file {
3333
echo "${metadata}"
3434
}
3535

36-
# $1: template name (required).
36+
# Assumed vars:
37+
# scope_flags
38+
# Parameters:
39+
# $1: template name (required).
3740
function create-linux-node-instance-template {
3841
local template_name="$1"
3942
ensure-gci-metadata-files
43+
# shellcheck disable=2154 # 'scope_flags' is assigned by upstream
4044
create-node-template "${template_name}" "${scope_flags[*]}" "$(get-node-instance-metadata-from-file)" "" "linux"
4145
}

cluster/update-storage-objects.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ set -o errexit
2525
set -o nounset
2626
set -o pipefail
2727

28-
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
28+
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
2929
source "${KUBE_ROOT}/hack/lib/init.sh"
3030

3131
KUBECTL="${KUBE_OUTPUT_HOSTBIN}/kubectl"
@@ -57,7 +57,7 @@ declare -a resources=(
5757
)
5858

5959
# Find all the namespaces.
60-
namespaces=( $("${KUBECTL}" get namespaces -o go-template="{{range.items}}{{.metadata.name}} {{end}}"))
60+
IFS=" " read -r -a namespaces <<< "$("${KUBECTL}" get namespaces -o go-template="{{range.items}}{{.metadata.name}} {{end}}")"
6161
if [ -z "${namespaces:-}" ]
6262
then
6363
echo "Unexpected: No namespace found. Nothing to do."
@@ -74,7 +74,7 @@ do
7474
# TODO hopefully we can remove this once we use dynamic discovery of gettable/updateable
7575
# resources.
7676
set +e
77-
instances=( $("${KUBECTL}" get "${resource}" --namespace="${namespace}" -o go-template="{{range.items}}{{.metadata.name}} {{end}}"))
77+
IFS=" " read -r -a instances <<< "$("${KUBECTL}" get "${resource}" --namespace="${namespace}" -o go-template="{{range.items}}{{.metadata.name}} {{end}}")"
7878
result=$?
7979
set -e
8080

hack/.shellcheck_failures

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
./cluster/gce/gci/health-monitor.sh
1313
./cluster/gce/gci/master-helper.sh
1414
./cluster/gce/gci/mounter/stage-upload.sh
15-
./cluster/gce/gci/node-helper.sh
1615
./cluster/gce/gci/shutdown.sh
1716
./cluster/gce/list-resources.sh
1817
./cluster/gce/upgrade-aliases.sh
@@ -34,7 +33,6 @@
3433
./cluster/test-e2e.sh
3534
./cluster/test-network.sh
3635
./cluster/test-smoke.sh
37-
./cluster/update-storage-objects.sh
3836
./cluster/validate-cluster.sh
3937
./hack/cherry_pick_pull.sh
4038
./hack/generate-bindata.sh
@@ -79,7 +77,6 @@
7977
./hack/update-generated-kms-dockerized.sh
8078
./hack/update-generated-protobuf-dockerized.sh
8179
./hack/update-generated-runtime-dockerized.sh
82-
./hack/update-generated-runtime.sh
8380
./hack/update-godep-licenses.sh
8481
./hack/update-gofmt.sh
8582
./hack/update-openapi-spec.sh

hack/update-generated-runtime.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ set -o errexit
1818
set -o nounset
1919
set -o pipefail
2020

21-
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
21+
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
2222

2323
# NOTE: All output from this script needs to be copied back to the calling
2424
# source tree. This is managed in kube::build::copy_output in build/common.sh.
2525
# If the output set is changed update that function.
2626

27-
${KUBE_ROOT}/build/run.sh hack/update-generated-runtime-dockerized.sh "$@"
27+
"${KUBE_ROOT}/build/run.sh" hack/update-generated-runtime-dockerized.sh "$@"
2828

2929
# ex: ts=2 sw=2 et filetype=sh

0 commit comments

Comments
 (0)