ELB parsing broken when listeners have applied policies #755

Open
jimbrowne opened this Issue May 16, 2012 · 4 comments

Comments

Projects
None yet
2 participants
Contributor

jimbrowne commented May 16, 2012

Tested against 2.1.1 and 2.4.0. Looks like loadbalancer.py is expecting only Listener stanzas inside of the member list for ListenerDescriptions. When PolicyNames is just a close tag it winds up as a setattr in the Listener object; when PolicyNames is its own list with enclosed member tags the parser is confused.

>>> elbs = elb.get_all_load_balancers('foo-vip')
>>> f = elbs[0]
>>> f.listeners[0].member
u'foo-vip-policy'
>>> f.listeners[0].protocol
''
>>> f.listeners[0].instance_port
0

See the PolicyNames description at http://docs.amazonwebservices.com/ElasticLoadBalancing/latest/APIReference/API_ListenerDescription.html

Anonymized section of XML return from AWS API:

<ListenerDescriptions>
  <member>
    <PolicyNames>
      <member>foo-vip-policy</member>
    </PolicyNames>
    <Listener>
      <Protocol>HTTP</Protocol>
      <LoadBalancerPort>80</LoadBalancerPort>
      <InstanceProtocol>HTTP</InstanceProtocol>
      <InstancePort>80</InstancePort>
    </Listener>
  </member>
  <member>
    <PolicyNames>
      <member>foo-vip-policy</member>
    </PolicyNames>
    <Listener>
      <Protocol>HTTPS</Protocol>
      <LoadBalancerPort>443</LoadBalancerPort>
      <InstanceProtocol>HTTP</InstanceProtocol>
      <SSLCertificateId>arn:aws:iam::12345678:server-certificate/foo.example.com.cert</SSLCertificateId>
      <InstancePort>81</InstancePort>
    </Listener>
  </member>
</ListenerDescriptions>
<Instances>
  <member>
    <InstanceId>i-deadbeef</InstanceId>
  </member>
  <member>
    <InstanceId>i-beeff00d</InstanceId>
  </member>
</Instances>
<Policies>
  <AppCookieStickinessPolicies/>
  <OtherPolicies/>
  <LBCookieStickinessPolicies>
    <member>
      <PolicyName>foo-vip-policy</PolicyName>
      <CookieExpirationPeriod>10800</CookieExpirationPeriod>
    </member>
  </LBCookieStickinessPolicies>
</Policies>

@jimbrowne jimbrowne added a commit to jimbrowne/boto that referenced this issue May 16, 2012

@jimbrowne jimbrowne Unit test that checks proper parsing of ELB listeners
Currently fails due to bug #755.  Should be enhanced to assert on
ELB listener policies once they are supported in the Listener
object.
a86845c

@jimbrowne jimbrowne added a commit to jimbrowne/boto that referenced this issue May 17, 2012

@jimbrowne jimbrowne Proposed fix for bug #755. Adds RO field policy_name. bbdce81
Contributor

jimbrowne commented May 17, 2012

Unit test in a86845c now passes when patch in bbdce81 is applied.

@jimbrowne jimbrowne added a commit to jimbrowne/boto that referenced this issue May 17, 2012

@jimbrowne jimbrowne Fix parsing of ELB policies, found while fixing bug #755 ec228f9
Contributor

jimbrowne commented May 17, 2012

I found ec228f9 while examining the LoadBalancer objects for this bug.

Owner

garnaat commented May 29, 2012

Are you going to submit a pull request? It looks like you have a fix in your branch.

Contributor

jimbrowne commented May 29, 2012

Doh! Thought I had. Just submitted one.

@msabramo msabramo pushed a commit to msabramo/boto that referenced this issue Nov 28, 2012

@jimbrowne jimbrowne Unit test that checks proper parsing of ELB listeners
Currently fails due to bug #755.  Should be enhanced to assert on
ELB listener policies once they are supported in the Listener
object.
add9120

@msabramo msabramo pushed a commit to msabramo/boto that referenced this issue Nov 28, 2012

@jimbrowne jimbrowne Proposed fix for bug #755. Adds RO field policy_name. 73bd915

@msabramo msabramo pushed a commit to msabramo/boto that referenced this issue Nov 28, 2012

@jimbrowne jimbrowne Fix parsing of ELB policies, found while fixing bug #755 06f95da
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment