agent: anti-entropy sync services/checks if they don't exist in the catalog

This commit is contained in:
Ryan Uber 2015-04-08 12:20:34 -07:00
parent b18d75120c
commit 80a6d7caca

View file

@ -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