Permalink
Browse files

Fixed replacement of latency-based routing records

with unit test.  Partially fixes #50
  • Loading branch information...
1 parent ba64f88 commit 836dc7db67172086856df97dfc10eacf886b9272 @jreitz jreitz committed with Dec 4, 2012
Showing with 14 additions and 2 deletions.
  1. +10 −2 scripts/cli53
  2. +4 −0 tests/test_commands.py
View
@@ -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:
View
@@ -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 836dc7d

Please sign in to comment.