Skip to content

Commit

Permalink
less fatals
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Winther <[email protected]>
  • Loading branch information
jippi committed Mar 8, 2019
1 parent c7a6199 commit e7252f5
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions backend/consul/deleter.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ func (b *Backend) DeleteService(service, node string) {
}, &api.WriteOptions{})

if err != nil {
log.Fatalf("Could not delete consul service %s for node %s: %s", service, node, err)
log.Errorf("Could not delete consul service %s for node %s: %s", service, node, err)
}
}

Expand All @@ -25,6 +25,6 @@ func (b *Backend) DeleteCheck(check, node string) {
}, &api.WriteOptions{})

if err != nil {
log.Fatalf("Could not delete consul check %s for node %s: %s", check, node, err)
log.Errorf("Could not delete consul check %s for node %s: %s", check, node, err)
}
}
2 changes: 1 addition & 1 deletion backend/consul/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func processCatalog(n internalNode) config.Services {
}

if _, ok := services[check.ServiceID]; !ok {
log.Fatalf("Could not find a service '%s' for check '%s'", check.ServiceID, check.CheckID)
log.Errorf("Could not find a service '%s' for check '%s'", check.ServiceID, check.CheckID)
}

services[check.ServiceID].CheckID = check.CheckID
Expand Down
2 changes: 1 addition & 1 deletion backend/consul/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ func (b *Backend) WriteService(service *config.Service) {
_, err := b.client.Catalog().Register(save, &api.WriteOptions{})

if err != nil {
log.Fatalf("Could not write consul catalog: %s", err)
log.Errorf("Could not write consul catalog: %s", err)
}
}
2 changes: 1 addition & 1 deletion service/rds/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func (r *RDS) getInstanceTags(instance *rds.DBInstance) config.Tags {
input := &rds.ListTagsForResourceInput{ResourceName: instance.DBInstanceArn}
x, err := r.rds.ListTagsForResource(input)
if err != nil {
log.Fatal(err)
log.Errorf(err)
}

res := make(config.Tags)
Expand Down
5 changes: 4 additions & 1 deletion service/rds/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ func (r *RDS) writeBackendCatalog(instance *config.DBInstance, logger *log.Entry
logger = logger.WithField("instance", aws.StringValue(instance.DBInstanceIdentifier))

name := r.getServiceName(instance)
if name == "" {
return
}
id := name

if *instance.DBInstanceStatus == "creating" {
Expand Down Expand Up @@ -226,7 +229,7 @@ func (r *RDS) getServiceName(instance *config.DBInstance) string {
return r.servicePrefix + name + r.serviceSuffix
}

log.Fatal("Failed to find service name for " + aws.StringValue(instance.DBInstanceArn))
log.Errorf("Failed to find service name for " + aws.StringValue(instance.DBInstanceArn))
return ""
}

Expand Down

0 comments on commit e7252f5

Please sign in to comment.