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