Skip to content

Commit

Permalink
Use Name tag for reverse resolution if set
Browse files Browse the repository at this point in the history
  • Loading branch information
Ilja Bobkevic committed Nov 26, 2015
1 parent f13da4d commit bf7c370
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion unbound_ec2/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,9 @@ def __determine_address(self, instance):
or ordered_address).encode("ascii")

def __determine_name(self, instance):
return '%s.%s.' % (instance.id, self.zone.strip('.'))
domain = self.zone.rstrip('.')
name = instance.tags['Name'].split(',')[0].rstrip('.') if 'Name' in instance.tags else instance.id
return '%s.' % (name if domain in name else '%s.%s' % (name, domain)).encode("ascii")

def forward_record(self, qname, instance):
return "%s %d IN A %s" % (qname, self.ttl, self.__determine_address(instance))
Expand Down

0 comments on commit bf7c370

Please sign in to comment.