agent: Handle API changes

This commit is contained in:
Armon Dadgar 2014-03-05 15:03:23 -08:00
parent 98fffdacb5
commit 3cf1a64f87
2 changed files with 16 additions and 14 deletions

View File

@ -308,7 +308,7 @@ func (d *DNSServer) nodeLookup(network, datacenter, node string, req, resp *dns.
}
// If we have no address, return not found!
if out.NodeServices.Node.Address == "" {
if out.NodeServices == nil {
resp.SetRcode(req, dns.RcodeNameError)
return
}

View File

@ -276,22 +276,24 @@ func (l *localState) setSyncState() error {
l.Lock()
defer l.Unlock()
for id, service := range services.Services {
// If we don't have the service locally, deregister it
existing, ok := l.services[id]
if !ok {
// The Consul service is created automatically, and
// does not need to be registered
if id == consul.ConsulServiceID && l.config.Server {
if services != nil {
for id, service := range services.Services {
// If we don't have the service locally, deregister it
existing, ok := l.services[id]
if !ok {
// The Consul service is created automatically, and
// does not need to be registered
if id == consul.ConsulServiceID && l.config.Server {
continue
}
l.serviceStatus[id] = syncStatus{remoteDelete: true}
continue
}
l.serviceStatus[id] = syncStatus{remoteDelete: true}
continue
}
// If our definition is different, we need to update it
equal := reflect.DeepEqual(existing, service)
l.serviceStatus[id] = syncStatus{inSync: equal}
// If our definition is different, we need to update it
equal := reflect.DeepEqual(existing, service)
l.serviceStatus[id] = syncStatus{inSync: equal}
}
}
for _, check := range checks {