mirror of
https://github.com/gravitl/netmaker.git
synced 2024-09-20 23:36:18 +08:00
leave comms automatically if last network
This commit is contained in:
parent
49b29a6615
commit
f5c8f6ed22
|
@ -95,6 +95,13 @@ func Leave(cfg config.ClientConfig, force bool) error {
|
|||
} else {
|
||||
ncutils.PrintLog("success", 0)
|
||||
}
|
||||
nets, err := ncutils.GetSystemNetworks()
|
||||
if err == nil && len(nets) == 1 {
|
||||
if nets[0] == cfg.Node.CommID {
|
||||
ncutils.PrintLog("detected comms as remaining network, removing...", 1)
|
||||
err = functions.LeaveNetwork(nets[0], true)
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue