mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 22:46:12 +00:00
Use format instead of awk to extract active account/project
This commit is contained in:
parent
804109d349
commit
add6feb53c
@ -1086,7 +1086,7 @@ function kube::release::gcs::verify_prereqs() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z "${GCLOUD_ACCOUNT-}" ]]; then
|
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
|
fi
|
||||||
if [[ -z "${GCLOUD_ACCOUNT-}" ]]; then
|
if [[ -z "${GCLOUD_ACCOUNT-}" ]]; then
|
||||||
echo "No account authorized through gcloud. Please fix with:"
|
echo "No account authorized through gcloud. Please fix with:"
|
||||||
@ -1096,7 +1096,7 @@ function kube::release::gcs::verify_prereqs() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z "${GCLOUD_PROJECT-}" ]]; then
|
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
|
fi
|
||||||
if [[ -z "${GCLOUD_PROJECT-}" ]]; then
|
if [[ -z "${GCLOUD_PROJECT-}" ]]; then
|
||||||
echo "No account authorized through gcloud. Please fix with:"
|
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() {
|
function kube::release::gcloud_account_is_active() {
|
||||||
local -r account="${1-}"
|
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
|
return 0
|
||||||
else
|
else
|
||||||
return 1
|
return 1
|
||||||
|
Loading…
Reference in New Issue
Block a user