mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-12 20:20:52 +08:00
leave comms automatically if last network
This commit is contained in:
@@ -95,6 +95,13 @@ func Leave(cfg config.ClientConfig, force bool) error {
|
|||||||
} else {
|
} else {
|
||||||
ncutils.PrintLog("success", 0)
|
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
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user