mirror of https://github.com/rancher/cli.git
fix panics
This commit is contained in:
parent
2cc3438cba
commit
49f30d1d26
|
|
@ -280,6 +280,9 @@ func cacheCredential(ctx *cli.Context, cred *config.ExecCredential, id string) e
|
|||
return err
|
||||
}
|
||||
|
||||
if sc.KubeCredentials[id] == nil {
|
||||
sc.KubeCredentials = make(map[string]*config.ExecCredential)
|
||||
}
|
||||
sc.KubeCredentials[id] = cred
|
||||
cf.Servers[server] = sc
|
||||
return cf.Write()
|
||||
|
|
|
|||
|
|
@ -71,8 +71,12 @@ func serverCurrent(ctx *cli.Context) error {
|
|||
}
|
||||
|
||||
serverName := cf.CurrentServer
|
||||
URL := cf.Servers[serverName].URL
|
||||
fmt.Printf("Name: %s URL: %s\n", serverName, URL)
|
||||
currentServer, found := cf.Servers[serverName]
|
||||
if !found {
|
||||
return errors.New("Current server not set")
|
||||
}
|
||||
|
||||
fmt.Printf("Name: %s URL: %s\n", serverName, currentServer.URL)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue