Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed case when weight was 0 for weighted records in Route53

Added Tests for Weighted CNAME Records (including Weight=0)
  • Loading branch information...
commit 9d3505dcbf33fc3f3e706c773d4b09391b30a16a 1 parent b91bf65
@allanparsons allanparsons authored Barnaby Gray committed
Showing with 9 additions and 3 deletions.
  1. +1 −1  scripts/cli53
  2. +8 −2 tests/test_commands.py
View
2  scripts/cli53
@@ -326,7 +326,7 @@ class BindToR53Formatter(object):
rrset = self._change(changes, chg, zone, name)
text_element(rrset, 'Type', dns.rdatatype.to_text(rdataset.rdtype))
text_element(rrset, 'SetIdentifier', rdtype.identifier)
- if rdtype.weight:
+ if rdtype.weight is not None:
text_element(rrset, 'Weight', str(rdtype.weight))
elif rdtype.region:
text_element(rrset, 'Region', str(rdtype.region))
View
10 tests/test_commands.py
@@ -39,14 +39,20 @@ def test_rrcreate(self):
self._cmd('rrcreate', self.zone, '', 'A', '10.0.0.1')
self._cmd('rrcreate', self.zone, 'www', 'CNAME', self.zone+'.', '-x 3600')
self._cmd('rrcreate', self.zone, 'info', 'TXT', 'this is a "test"')
-
+ self._cmd('rrcreate', self.zone, 'weighttest1', 'CNAME', self.zone+'.', '-x 60', '-w 0', '-i awsweightzero')
+ self._cmd('rrcreate', self.zone, 'weighttest2', 'CNAME', self.zone+'.', '-x 60', '-w 1', '-i awsweightone')
+ self._cmd('rrcreate', self.zone, 'weighttest3', 'CNAME', self.zone+'.', '-x 60', '-w 50', '-i awsweightfifty')
+
output = self._cmd('export', self.zone)
- output = [ x for x in output.split('\n') if '10.0.0.1' in x or 'www' in x or 'TXT' in x ]
+ output = [ x for x in output.split('\n') if '10.0.0.1' in x or 'CNAME' in x or 'TXT' in x ]
self.assertEqual(
[
"@ 86400 IN A 10.0.0.1",
'info 86400 IN TXT "this is a \\"test\\""',
+ "weighttest1 60 AWS CNAME 0 %s. awsweightzero" % self.zone,
+ "weighttest2 60 AWS CNAME 1 %s. awsweightone" % self.zone,
+ "weighttest3 60 AWS CNAME 50 %s. awsweightfifty" % self.zone,
"www 3600 IN CNAME %s." % self.zone,
],
output
Please sign in to comment.
Something went wrong with that request. Please try again.