mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-05 08:47:35 +08:00
fixing sso error handling
This commit is contained in:
@@ -301,8 +301,7 @@ func WipeLocal(cfg *config.ClientConfig) error {
|
||||
if cfg.Node.Interface != "" {
|
||||
if ncutils.FileExists(dir + cfg.Node.Interface + ".conf") {
|
||||
if err := os.Remove(dir + cfg.Node.Interface + ".conf"); err != nil {
|
||||
log.Println("error removing .conf:")
|
||||
log.Println(err.Error())
|
||||
logger.Log(0, err.Error())
|
||||
fail = true
|
||||
}
|
||||
}
|
||||
|
@@ -82,6 +82,7 @@ func JoinViaSSo(cfg *config.ClientConfig, privateKey string) error {
|
||||
}
|
||||
loginMsg.User = global_settings.User
|
||||
loginMsg.Password = string(pass)
|
||||
fmt.Println("attempting login...")
|
||||
}
|
||||
|
||||
msgTx, err := json.Marshal(loginMsg)
|
||||
@@ -101,7 +102,6 @@ func JoinViaSSo(cfg *config.ClientConfig, privateKey string) error {
|
||||
// Wait to receive something from server
|
||||
_, msg, err := conn.ReadMessage()
|
||||
if err != nil {
|
||||
log.Println("Error in receive:", err)
|
||||
return err
|
||||
}
|
||||
// Print message from the netmaker controller to the user
|
||||
@@ -121,6 +121,11 @@ func JoinViaSSo(cfg *config.ClientConfig, privateKey string) error {
|
||||
for {
|
||||
msgType, msg, err := conn.ReadMessage()
|
||||
if err != nil {
|
||||
if msgType < 0 {
|
||||
logger.Log(1, "received close message from server")
|
||||
done <- struct{}{}
|
||||
return
|
||||
}
|
||||
// Error reading a message from the server
|
||||
if !strings.Contains(err.Error(), "normal") {
|
||||
logger.Log(0, "read:", err.Error())
|
||||
|
Reference in New Issue
Block a user