Skip to content

Commit

Permalink
move service.ServiceMeta up
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Winther <[email protected]>
  • Loading branch information
jippi committed Jan 30, 2019
1 parent 4525285 commit 7dd32b1
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions service/rds/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,13 @@ func (r *RDS) writeBackendCatalog(instance *config.DBInstance, logger *log.Entry
CheckOutput: fmt.Sprintf("Pending tasks: %s\n\nAddr: %s\n\nmanaged by aws-dynamic-consul-catalog", instance.PendingModifiedValues.GoString(), addr),
}

service.ServiceMeta = make(map[string]string)
service.ServiceMeta["Engine"] = aws.StringValue(instance.Engine)
service.ServiceMeta["EngineVersion"] = aws.StringValue(instance.EngineVersion)
service.ServiceMeta["DBName"] = aws.StringValue(instance.DBName)
service.ServiceMeta["DBInstanceClass"] = aws.StringValue(instance.DBInstanceClass)
service.ServiceMeta["DBInstanceIdentifier"] = aws.StringValue(instance.DBInstanceIdentifier)

if stringInSlice(service.ServiceID, seen.Services) {
logger.Errorf("Found duplicate Service ID %s - possible duplicate 'consul_service_name' RDS tag with same Replication Role", service.ServiceID)
if r.onDuplicate == "quit" {
Expand All @@ -180,13 +187,6 @@ func (r *RDS) writeBackendCatalog(instance *config.DBInstance, logger *log.Entry
}
seen.Services = append(seen.Services, service.ServiceID)

service.ServiceMeta = make(map[string]string)
service.ServiceMeta["Engine"] = aws.StringValue(instance.Engine)
service.ServiceMeta["EngineVersion"] = aws.StringValue(instance.EngineVersion)
service.ServiceMeta["DBName"] = aws.StringValue(instance.DBName)
service.ServiceMeta["DBInstanceClass"] = aws.StringValue(instance.DBInstanceClass)
service.ServiceMeta["DBInstanceIdentifier"] = aws.StringValue(instance.DBInstanceIdentifier)

if stringInSlice(service.CheckID, seen.Checks) {
logger.Errorf("Found duplicate Check ID %s - possible duplicate 'consul_service_name' RDS tag with same Replication Role", service.CheckID)
if r.onDuplicate == "quit" {
Expand Down

0 comments on commit 7dd32b1

Please sign in to comment.