From 5f4622615994af1c8bd7f5cf8c1b5dcc0956578d Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Mon, 15 Aug 2022 17:50:24 -0700 Subject: fix(shellcheck): apply recommendations from shellcheck Change-Id: Id11ad998c30d6e863ab3b43552b9fe248a0d6c7f Reviewed-on: https://cl.fcuny.net/c/world/+/716 Tested-by: CI Reviewed-by: Franck Cuny --- ops/tf-gcs-init/tf-gcs-init.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'ops') diff --git a/ops/tf-gcs-init/tf-gcs-init.sh b/ops/tf-gcs-init/tf-gcs-init.sh index 3a8f2b3..95d4d7e 100755 --- a/ops/tf-gcs-init/tf-gcs-init.sh +++ b/ops/tf-gcs-init/tf-gcs-init.sh @@ -26,7 +26,7 @@ GCP_SERVICE_ACCOUNT_ROLES=( ) function bucket:exist() { - if gsutil ls gs://${1} &>/dev/null; then + if gsutil ls gs://"${1}" &>/dev/null; then true else false @@ -67,11 +67,11 @@ function service_account() { } function service_account:has_role() { - [[ $(gcloud projects get-iam-policy ${1} --flatten=bindings --filter="bindings.members=serviceAccount:${2} AND bindings.role=$3" 2>/dev/null | wc -l) -ne 0 ]] + [[ $(gcloud projects get-iam-policy "${1}" --flatten=bindings --filter="bindings.members=serviceAccount:${2} AND bindings.role=$3" 2>/dev/null | wc -l) -ne 0 ]] } function service_account:admins_token_creator() { - [[ $(gcloud --project=${1} iam service-accounts get-iam-policy ${GCP_SERVICE_ACCOUNT} --flatten=bindings --filter="bindings.members=user:${GCP_ADMIN_ACCOUNT} AND bindings.role=roles/iam.serviceAccountTokenCreator" 2>/dev/null | wc -l) -ne 0 ]] + [[ $(gcloud --project="${1}" iam service-accounts get-iam-policy ${GCP_SERVICE_ACCOUNT} --flatten=bindings --filter="bindings.members=user:${GCP_ADMIN_ACCOUNT} AND bindings.role=roles/iam.serviceAccountTokenCreator" 2>/dev/null | wc -l) -ne 0 ]] } function roles() { -- cgit 1.4.1