Skip to content

Commit

Permalink
Merge pull request kubernetes#4353 from erictune/fix_get_password
Browse files Browse the repository at this point in the history
Don't fail get-password when no current-context.
  • Loading branch information
roberthbailey committed Feb 11, 2015
2 parents 2ed8885 + c348b30 commit 0194ed8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cluster/gce/util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,9 @@ function detect-master () {
# KUBE_PASSWORD
function get-password {
# go template to extract the auth-path of the current-context user
local template='{{$ctx := index . "current-context"}}{{$user := index . "contexts" $ctx "user"}}{{index . "users" $user "auth-path"}}'
local template='{{with $ctx := index . "current-context"}}{{$user := index . "contexts" $ctx "user"}}{{index . "users" $user "auth-path"}}{{end}}'
local file=$("${KUBE_ROOT}/cluster/kubectl.sh" config view -o template --template="${template}")
if [[ -r "$file" ]]; then
if [[ ! -z "$file" && -r "$file" ]]; then
KUBE_USER=$(cat "$file" | python -c 'import json,sys;print json.load(sys.stdin)["User"]')
KUBE_PASSWORD=$(cat "$file" | python -c 'import json,sys;print json.load(sys.stdin)["Password"]')
return
Expand Down

0 comments on commit 0194ed8

Please sign in to comment.