Skip to content

Commit e5eec1e

Browse files
prometherionmjuraga
authored andcommitted
BUG/MINOR: aws: sanity checking for instance service tags
1 parent 4022494 commit e5eec1e

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

discovery/aws_service_discovery_instance.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,8 @@ func (a *awsInstance) updateServices(api *ec2.Client) (err error) {
249249
var sn string
250250
sn, err = a.serviceNameFromEC2(i)
251251
if err != nil {
252+
a.logErrorf("unable to retrieve service name for the instance %s", *i.InstanceId)
253+
252254
continue
253255
}
254256
// creating empty service in case it isn't there
@@ -262,6 +264,13 @@ func (a *awsInstance) updateServices(api *ec2.Client) (err error) {
262264
}
263265
}
264266
instanceID := aws.ToString(i.InstanceId)
267+
268+
if _, portErr := mapService[sn].instancePortFromEC2(i); portErr != nil {
269+
a.logErrorf("unable to retrieve service port for the instance %s", *i.InstanceId)
270+
271+
continue
272+
}
273+
265274
mapService[sn].instances[instanceID] = i
266275
}
267276
}

0 commit comments

Comments
 (0)