Fix route53 multiple values bug. Closes #358.
This commit is contained in:
parent
7ec3f13597
commit
57f1199b35
@ -55,7 +55,11 @@ def rrset_response(request, full_url, headers):
|
||||
action = value['Action']
|
||||
record_set = value['ResourceRecordSet']
|
||||
if action == 'CREATE':
|
||||
record_set['ResourceRecords'] = [x['Value'] for x in record_set['ResourceRecords'].values()]
|
||||
resource_records = record_set['ResourceRecords'].values()[0]
|
||||
if not isinstance(resource_records, list):
|
||||
# Depending on how many records there are, this may or may not be a list
|
||||
resource_records = [resource_records]
|
||||
record_set['ResourceRecords'] = [x['Value'] for x in resource_records]
|
||||
the_zone.add_rrset(record_set)
|
||||
elif action == "DELETE":
|
||||
if 'SetIdentifier' in record_set:
|
||||
|
@ -92,6 +92,23 @@ def test_rrset():
|
||||
rrsets.should.have.length_of(0)
|
||||
|
||||
|
||||
@mock_route53
|
||||
def test_rrset_with_multiple_values():
|
||||
conn = boto.connect_route53('the_key', 'the_secret')
|
||||
zone = conn.create_hosted_zone("testdns.aws.com")
|
||||
zoneid = zone["CreateHostedZoneResponse"]["HostedZone"]["Id"].split("/")[-1]
|
||||
|
||||
changes = ResourceRecordSets(conn, zoneid)
|
||||
change = changes.add_change("CREATE", "foo.bar.testdns.aws.com", "A")
|
||||
change.add_value("1.2.3.4")
|
||||
change.add_value("5.6.7.8")
|
||||
changes.commit()
|
||||
|
||||
rrsets = conn.get_all_rrsets(zoneid, type="A")
|
||||
rrsets.should.have.length_of(1)
|
||||
set(rrsets[0].resource_records).should.equal(set(['1.2.3.4', '5.6.7.8']))
|
||||
|
||||
|
||||
@mock_route53
|
||||
def test_create_health_check():
|
||||
conn = boto.connect_route53('the_key', 'the_secret')
|
||||
|
Loading…
Reference in New Issue
Block a user