Skip to content
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

get_hosted_zone - multiple VPC associations to a private zone #3671

Open
ksivask opened this issue Jan 26, 2017 · 0 comments
Open

get_hosted_zone - multiple VPC associations to a private zone #3671

ksivask opened this issue Jan 26, 2017 · 0 comments

Comments

@ksivask
Copy link

ksivask commented Jan 26, 2017

>>> boto.__version__
'2.45.0'
[zone-vpcs.txt](https://github.com/boto/boto/files/731411/zone-vpcs.txt)

>>> r53c.get_hosted_zone('Z21777K8BLAH')

DEBUG:boto:<?xml version="1.0"?>
<GetHostedZoneResponse xmlns="https://route53.amazonaws.com/doc/2013-04-01/"><HostedZone><Id>/hostedzone/Z21777K8BLAH</Id><Name>eng.blah.net.</Name><CallerReference>38E618A9-B9DB-3C00-9260-A58625F5DA84</CallerReference><Config><Comment>private subdomain</Comment><PrivateZone>true</PrivateZone></Config><ResourceRecordSetCount>2</ResourceRecordSetCount></HostedZone><VPCs><VPC><VPCRegion>us-west-2</VPCRegion><VPCId>vpc-19295xxx</VPCId></VPC><VPC><VPCRegion>us-east-1</VPCRegion><VPCId>vpc-f6d9dxxx</VPCId></VPC></VPCs></GetHostedZoneResponse>

{u'GetHostedZoneResponse': {u'VPCs': {u'VPC': {u'VPCId': u'vpc-f6d9dxxx', u'VPCRegion': u'us-east-1'}}, u'HostedZone': {u'ResourceRecordSetCount': u'2', u'CallerReference': u'38E618A9-B9DB-3C00-9260-A58625F5DA84', u'Config': {u'Comment': u'private subdomain', u'PrivateZone': u'true'}, u'Id': u'/hostedzone/Z21777K8BLAH', u'Name': u'eng.blah.net.'}}}

The multiple VPC associations are returned in the XML response, but the post-parsing returns only 1 item.

Fix:

>>> e = boto.jsonresponse.Element(list_marker=('NameServers', 'VPCs'), item_marker=('NameServer', 'VPC',))
>>> h=boto.jsonresponse.XmlHandler(e, None)
>>> h=boto.jsonresponse.XmlHandler(e, None)
>>> h.parse(body)
>>> e
{u'GetHostedZoneResponse': {u'VPCs': [{u'VPCId': u'vpc-19295xxx', u'VPCRegion': u'us-west-2'}, {u'VPCId': u'vpc-f6d9dxxx', u'VPCRegion': u'us-east-1'}], u'HostedZone': {u'ResourceRecordSetCount': u'2', u'CallerReference': u'38E618A9-B9DB-3C00-9260-A58625F5DA84', u'Config': {u'Comment': u'private subdomain', u'PrivateZone': u'true'}, u'Id': u'/hostedzone/Z21777K8ACVYHU', u'Name': u'eng.blah.net.'}}}

Since http://docs.aws.amazon.com/Route53/latest/APIReference/API_GetHostedZone.html indicates NameServers and VPCs as lists, the code should adjust for both
zone-vpcs.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant