also skip /etc/hosts on termination if disabled
This commit is contained in:
parent
6dce678483
commit
3559fcf3b3
7
main.go
7
main.go
|
@ -45,6 +45,7 @@ func main() {
|
||||||
|
|
||||||
incomingSigs := make(chan os.Signal, 1)
|
incomingSigs := make(chan os.Signal, 1)
|
||||||
signal.Notify(incomingSigs, syscall.SIGTERM, os.Interrupt)
|
signal.Notify(incomingSigs, syscall.SIGTERM, os.Interrupt)
|
||||||
|
logrus.Debug("waiting for cluster events")
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case nodes := <-nodec:
|
case nodes := <-nodec:
|
||||||
|
@ -71,8 +72,10 @@ func main() {
|
||||||
case <-incomingSigs:
|
case <-incomingSigs:
|
||||||
logrus.Info("terminating...")
|
logrus.Info("terminating...")
|
||||||
cluster.leave()
|
cluster.leave()
|
||||||
if err := writeToEtcHosts(nil); err != nil {
|
if !config.NoEtcHosts {
|
||||||
logrus.Errorf("could not remove stale hosts entries: %s", err)
|
if err := writeToEtcHosts(nil); err != nil {
|
||||||
|
logrus.Errorf("could not remove stale hosts entries: %s", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if err := wg.downInterface(); err != nil {
|
if err := wg.downInterface(); err != nil {
|
||||||
logrus.Errorf("could not down interface: %s", err)
|
logrus.Errorf("could not down interface: %s", err)
|
||||||
|
|
Loading…
Reference in New Issue