Skip to content

Commit

Permalink
Merge pull request #809 from porter-dev/0.4.2-fix-cli-login-token
Browse files Browse the repository at this point in the history
[0.4.2] Fix CLI login with token issue causing failed deployments on `v0.4.0`
  • Loading branch information
abelanger5 authored Jun 22, 2021
2 parents 593415c + 38b8bd0 commit 7d6ad80
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
9 changes: 8 additions & 1 deletion cli/cmd/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,14 @@ func login() error {
user, _ := client.AuthCheck(context.Background())

if user != nil {
color.Yellow("You are already logged in. If you'd like to log out, run \"porter auth logout\".")
if config.Token != "" {
// set the token if the user calls login with the --token flag
config.SetToken(config.Token)
color.New(color.FgGreen).Println("Successfully logged in!")
} else {
color.Yellow("You are already logged in. If you'd like to log out, run \"porter auth logout\".")
}

return nil
}

Expand Down
3 changes: 0 additions & 3 deletions internal/kubernetes/nodes/nodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package nodes

import (
"context"
"fmt"
"sync"

v1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -67,8 +66,6 @@ func GetNodesUsage(clientset kubernetes.Interface) []*NodeWithUsageData {
}

func getPodsForNode(clientset kubernetes.Interface, nodeName string) *v1.PodList {
fmt.Printf("%s", nodeName)

podList, _ := clientset.CoreV1().Pods("").List(context.TODO(), metav1.ListOptions{
FieldSelector: "spec.nodeName=" + nodeName + ",status.phase=Running",
})
Expand Down
4 changes: 2 additions & 2 deletions server/api/k8s_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func (app *App) HandleListNamespaces(w http.ResponseWriter, r *http.Request) {
// HandleCreateNamespace creates a new namespace given the name.
func (app *App) HandleCreateNamespace(w http.ResponseWriter, r *http.Request) {
vals, err := url.ParseQuery(r.URL.RawQuery)
fmt.Println(vals)

if err != nil {
app.handleErrorFormDecoding(err, ErrReleaseDecode, w)
return
Expand Down Expand Up @@ -1064,7 +1064,7 @@ func (app *App) HandleStreamControllerStatus(w http.ResponseWriter, r *http.Requ
selectors := ""
if vals["selectors"] != nil {
selectors = vals["selectors"][0]
}
}
err = agent.StreamControllerStatus(conn, kind, selectors)

if err != nil {
Expand Down

0 comments on commit 7d6ad80

Please sign in to comment.