Skip to content

Commit

Permalink
Fixed replacement of latency-based routing records
Browse files Browse the repository at this point in the history
with unit test.  Partially fixes barnybug#50
  • Loading branch information
jreitz committed Dec 4, 2012
1 parent f2545fb commit 9d1a9b4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
12 changes: 10 additions & 2 deletions scripts/cli53
Expand Up @@ -594,8 +594,16 @@ def cmd_rrcreate(args):
if node:
for rds in node.rdatasets:
if args.type == dns.rdatatype.to_text(rds.rdtype):
rdataset_old = rds
break
# find the rds in the requested region only
if args.region is not None:
for rdtype in rds.items:
if hasattr(rdtype, 'region') and rdtype.region == args.region:
rdataset_old = rds
break
else:
rdataset_old = rds
break


f = BindToR53Formatter()
if args.replace and rdataset_old:
Expand Down
4 changes: 4 additions & 0 deletions tests/test_commands.py
Expand Up @@ -56,3 +56,7 @@ def test_rrdelete(self):
self._cmd('rrcreate', self.zone, '', 'A', '10.0.0.1')
self._cmd('rrdelete', self.zone, '', 'A')

def test_rrcreate_replace_latency(self):
self._cmd('rrcreate', '-i', 'asiacdn', '--region', 'ap-southeast-1', self.zone, 'cdn', 'CNAME', 'asiacdn.com.')
self._cmd('rrcreate', '-i', 'statescdn', '--region', 'us-west-1', self.zone, 'cdn', 'CNAME', 'uscdn.com.')
self._cmd('rrcreate', '-i', 'newuscdn', '--region', 'us-west-1', self.zone, 'cdn', 'CNAME', 'newuscdn.com.', '-r')

0 comments on commit 9d1a9b4

Please sign in to comment.