New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Truncated Response Handling in Route53 ListResourceRecordSets #2542

Merged
merged 2 commits into from Sep 2, 2014

Conversation

Projects
None yet
2 participants
@wil
Contributor

wil commented Aug 21, 2014

According to the Route53 Documentation, when a response is truncated, we could get a NextRecordIdentifier element.

We encountered an instance where one weighted resource recordset was returned as the last element of the response, and boto did not take NextRecordIdentifier into account so the record was returned again in the next iteration of the GET.

Example snippet:

...
    <ResourceRecordSet><Name>example.foo.com.</Name><Type>A</Type><SetIdentifier>primary</SetIdentifier><Weight>100</Weight><TTL>1800</TTL><ResourceRecords><ResourceRecord><Value>127.0.0.1</Value></ResourceRecord></ResourceRecords></ResourceRecordSet>
  </ResourceRecordSets>
  <IsTruncated>true</IsTruncated>
  <NextRecordName>example.foo.com.</NextRecordName>
  <NextRecordType>A</NextRecordType>
  <NextRecordIdentifier>secondary</NextRecordIdentifier>
  <MaxItems>100</MaxItems>
</ListResourceRecordSetsResponse>

DEBUG:boto:Method: GET
DEBUG:boto:Path: /2013-04-01/hostedzone/XXXXX/rrset?type=A&name=example.foo.com.
DEBUG:boto:Data:
DEBUG:boto:Headers: {}
DEBUG:boto:Host: route53.amazonaws.com
DEBUG:boto:Port: 443
DEBUG:boto:Params: {}
DEBUG:boto:Token: None
DEBUG:boto:Saw HTTP status: 200
DEBUG:boto:<?xml version="1.0"?>
<ListResourceRecordSetsResponse xmlns="https://route53.amazonaws.com/doc/2013-04-01/">
  <ResourceRecordSets>
    <ResourceRecordSet><Name>example.foo.com.</Name><Type>A</Type><SetIdentifier>primary</SetIdentifier><Weight>100</Weight><TTL>1800</TTL><ResourceRecords><ResourceRecord><Value>127.0.0.1</Value></ResourceRecord></ResourceRecords></ResourceRecordSet>

Notice the that the "example.foo.com." record was a duplicate.

This patch fixes the issue by remembering the NextRecordIdentifier value (in addition to NextRecordName and NextRecordType) in the first request and sending it in the second GET request.

@danielgtaylor

This comment has been minimized.

Show comment
Hide comment
@danielgtaylor

danielgtaylor Aug 22, 2014

Member

Thanks for the pull request! This looks great, but can't be merged until it includes tests covering the new code. Can you please add a unit test that simulates/uses the next record identifier? Thanks. 👍

Member

danielgtaylor commented Aug 22, 2014

Thanks for the pull request! This looks great, but can't be merged until it includes tests covering the new code. Can you please add a unit test that simulates/uses the next record identifier? Thanks. 👍

@wil

This comment has been minimized.

Show comment
Hide comment
@wil

wil Aug 26, 2014

Contributor

@danielgtaylor i've added a test case exercising truncated response. Let me know if that looks alright.

Contributor

wil commented Aug 26, 2014

@danielgtaylor i've added a test case exercising truncated response. Let me know if that looks alright.

@danielgtaylor

This comment has been minimized.

Show comment
Hide comment
@danielgtaylor

danielgtaylor Sep 2, 2014

Member

Thanks!

Member

danielgtaylor commented Sep 2, 2014

Thanks!

danielgtaylor added a commit that referenced this pull request Sep 2, 2014

Merge pull request #2542 from cloudregistry/r53_list_rrsets_paging_fix
Truncated Response Handling in Route53 ListResourceRecordSets. Fixes #2542.

@danielgtaylor danielgtaylor merged commit 3ba380f into boto:develop Sep 2, 2014

1 check passed

continuous-integration/travis-ci The Travis CI build passed
Details

Grindizer added a commit to Grindizer/boto that referenced this pull request Oct 2, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment