mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-07 09:41:37 +08:00
remove comms network leftovers
Signed-off-by: Matthew R. Kasun <mkasun@nusak.ca>
This commit is contained in:
@@ -10,36 +10,11 @@ import (
|
||||
"github.com/gravitl/netmaker/netclient/ncutils"
|
||||
)
|
||||
|
||||
// JoinComms -- Join the message queue comms network if it doesn't have it
|
||||
// tries to ping if already found locally, if fail ping pull for best effort for communication
|
||||
func JoinComms(cfg *config.ClientConfig) error {
|
||||
commsCfg := &config.ClientConfig{}
|
||||
commsCfg.Server.AccessKey = cfg.Server.AccessKey
|
||||
commsCfg.Server.CoreDNSAddr = cfg.Server.CoreDNSAddr
|
||||
if commsCfg.ConfigFileExists() {
|
||||
return nil
|
||||
}
|
||||
commsCfg.ReadConfig()
|
||||
|
||||
if len(commsCfg.Node.Name) == 0 {
|
||||
if err := functions.JoinNetwork(commsCfg, "", true); err != nil {
|
||||
return err
|
||||
}
|
||||
} else { // check if comms is currently reachable
|
||||
if err := functions.PingServer(commsCfg); err != nil {
|
||||
if err = Pull(commsCfg); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Join - join command to run from cli
|
||||
func Join(cfg *config.ClientConfig, privateKey string) error {
|
||||
var err error
|
||||
//join network
|
||||
err = functions.JoinNetwork(cfg, privateKey, false)
|
||||
err = functions.JoinNetwork(cfg, privateKey)
|
||||
if err != nil && !cfg.DebugOn {
|
||||
if !strings.Contains(err.Error(), "ALREADY_INSTALLED") {
|
||||
logger.Log(1, "error installing: ", err.Error())
|
||||
@@ -89,13 +64,6 @@ func Leave(cfg *config.ClientConfig, force bool) error {
|
||||
} else {
|
||||
logger.Log(0, "success")
|
||||
}
|
||||
//nets, err := ncutils.GetSystemNetworks()
|
||||
//if err == nil && len(nets) == 1 {
|
||||
//if nets[0] == cfg.Node.CommID {
|
||||
//logger.Log(1, "detected comms as remaining network, removing...")
|
||||
//err = functions.LeaveNetwork(nets[0], true)
|
||||
//}
|
||||
//}
|
||||
return err
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user