From add6feb53cc67228325c1f95ca221ec7995410b0 Mon Sep 17 00:00:00 2001 From: Erick Fejta Date: Wed, 3 Aug 2016 10:46:20 -0700 Subject: [PATCH] Use format instead of awk to extract active account/project --- build/common.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build/common.sh b/build/common.sh index b70bf1b6d8d..2a8f0892a33 100755 --- a/build/common.sh +++ b/build/common.sh @@ -1086,7 +1086,7 @@ function kube::release::gcs::verify_prereqs() { fi if [[ -z "${GCLOUD_ACCOUNT-}" ]]; then - GCLOUD_ACCOUNT=$(gcloud auth list 2>/dev/null | awk '/(active)/ { print $2 }') + GCLOUD_ACCOUNT=$(gcloud config list --format='value(core.account)' 2>/dev/null) fi if [[ -z "${GCLOUD_ACCOUNT-}" ]]; then echo "No account authorized through gcloud. Please fix with:" @@ -1096,7 +1096,7 @@ function kube::release::gcs::verify_prereqs() { fi if [[ -z "${GCLOUD_PROJECT-}" ]]; then - GCLOUD_PROJECT=$(gcloud config list project | awk '{project = $3} END {print project}') + GCLOUD_PROJECT=$(gcloud config list --format='value(core.project)' 2>/dev/null) fi if [[ -z "${GCLOUD_PROJECT-}" ]]; then echo "No account authorized through gcloud. Please fix with:" @@ -1594,7 +1594,7 @@ function kube::release::docker::release() { function kube::release::gcloud_account_is_active() { local -r account="${1-}" - if [[ -n $(gcloud auth list --filter-account $account 2>/dev/null | grep "active") ]]; then + if [[ "$(gcloud config list --format='value(core.account)')" == "${account}" ]]; then return 0 else return 1