mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-05 08:47:35 +08:00
merge conflicts resolved
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package command
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
@@ -15,6 +16,27 @@ import (
|
||||
func Join(cfg *config.ClientConfig, privateKey string) error {
|
||||
var err error
|
||||
//join network
|
||||
if cfg.SsoServer != "" {
|
||||
// User wants to get access key from the OIDC server
|
||||
// Do that before the Joining Network flow by performing the end point auth flow
|
||||
// if performed successfully an access key is obtained from the server and then we
|
||||
// proceed with the usual flow 'pretending' that user is feeded us with an access token
|
||||
if len(cfg.Network) == 0 || cfg.Network == "all" {
|
||||
return fmt.Errorf("no network provided. Specify network with \"-n <net name>\"")
|
||||
}
|
||||
logger.Log(1, "Logging into %s via:", cfg.Network, cfg.SsoServer)
|
||||
err = functions.JoinViaSSo(cfg, privateKey)
|
||||
if err != nil {
|
||||
logger.Log(0, "Join failed: ", err.Error())
|
||||
return err
|
||||
}
|
||||
|
||||
if cfg.AccessKey == "" {
|
||||
return errors.New("login failed")
|
||||
}
|
||||
}
|
||||
|
||||
logger.Log(1, "Joining network: ", cfg.Network)
|
||||
err = functions.JoinNetwork(cfg, privateKey)
|
||||
if err != nil {
|
||||
if !strings.Contains(err.Error(), "ALREADY_INSTALLED") {
|
||||
|
Reference in New Issue
Block a user