From 61783f113c0402253c73766c2e51df809765ca66 Mon Sep 17 00:00:00 2001 From: javierros Date: Thu, 9 Nov 2017 23:52:07 +0100 Subject: [PATCH] A record creation bug solved --- Service_Discovery_Using_DNS.template | 2 +- Service_Discovery_Using_DNS_cwlogging.template | 2 +- ecssd_agent.go | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Service_Discovery_Using_DNS.template b/Service_Discovery_Using_DNS.template index 9b78962..c3a3fe4 100644 --- a/Service_Discovery_Using_DNS.template +++ b/Service_Discovery_Using_DNS.template @@ -283,7 +283,7 @@ "group" : "root" }, "/usr/local/bin/ecssd_agent": { - "source" : "https://github.com/awslabs/service-discovery-ecs-dns/releases/download/1.5/ecssd_agent", + "source" : "https://github.com/awslabs/service-discovery-ecs-dns/releases/download/1.6/ecssd_agent", "mode" : "000755", "owner" : "root", "group" : "root" diff --git a/Service_Discovery_Using_DNS_cwlogging.template b/Service_Discovery_Using_DNS_cwlogging.template index 2a3cc17..4db4ba3 100644 --- a/Service_Discovery_Using_DNS_cwlogging.template +++ b/Service_Discovery_Using_DNS_cwlogging.template @@ -287,7 +287,7 @@ }, "/usr/local/bin/ecssd_agent": { - "source" : "https://github.com/awslabs/service-discovery-ecs-dns/releases/download/1.5/ecssd_agent", + "source" : "https://github.com/awslabs/service-discovery-ecs-dns/releases/download/1.6/ecssd_agent", "mode" : "000755", "owner" : "root", "group" : "root" diff --git a/ecssd_agent.go b/ecssd_agent.go index 95596db..4cfec98 100644 --- a/ecssd_agent.go +++ b/ecssd_agent.go @@ -208,7 +208,7 @@ func createARecord(hostName string, localIP string) error { { Action: aws.String(route53.ChangeActionCreate), ResourceRecordSet: &route53.ResourceRecordSet{ - Name: aws.String(strings.Split(hostName, ".")[0]), + Name: aws.String(strings.Split(hostName, ".")[0] + "." + DNSName), // It creates an A record with the IP of the host running the agent Type: aws.String(route53.RRTypeA), ResourceRecords: []*route53.ResourceRecord{ @@ -243,7 +243,7 @@ func removeARecord(hostName string) error { paramsList := &route53.ListResourceRecordSetsInput{ HostedZoneId: aws.String(configuration.HostedZoneId), // Required MaxItems: aws.String("1"), - StartRecordName: aws.String(strings.Split(hostName, ".")[0]), + StartRecordName: aws.String(strings.Split(hostName, ".")[0] + "." + DNSName), StartRecordType: aws.String(route53.RRTypeA), } resp, err := r53.ListResourceRecordSets(paramsList)