From a60f4adf9502b552b7965019b749382cf0e9ba7b Mon Sep 17 00:00:00 2001 From: Ryan Uber Date: Wed, 8 Apr 2015 12:20:34 -0700 Subject: [PATCH] agent: anti-entropy sync services/checks if they don't exist in the catalog --- command/agent/local.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/command/agent/local.go b/command/agent/local.go index 38b5ee1699..d5c6062f60 100644 --- a/command/agent/local.go +++ b/command/agent/local.go @@ -316,6 +316,13 @@ func (l *localState) setSyncState() error { l.Lock() defer l.Unlock() + for id, _ := range l.services { + // If the local service doesn't exist remotely, then sync it + if _, ok := services.Services[id]; !ok { + l.serviceStatus[id] = syncStatus{inSync: false} + } + } + if services != nil { for id, service := range services.Services { // If we don't have the service locally, deregister it @@ -331,6 +338,16 @@ func (l *localState) setSyncState() error { } } + for id, _ := range l.checks { + // Sync any check which doesn't exist on the remote side + for _, check := range checks { + if check.CheckID == id { + continue + } + l.checkStatus[id] = syncStatus{inSync: false} + } + } + for _, check := range checks { // If we don't have the check locally, deregister it id := check.CheckID