Pull SSL certificate IDs from existing ELBs

This commit is contained in:
Doug Ellwanger 2014-09-29 13:02:48 -07:00 committed by Matt Clay
parent f5961f9ecf
commit cc6cc6e302

View file

@ -341,7 +341,7 @@ class ElbManager(object):
}
if check_elb.listeners:
info['listeners'] = [l.get_complex_tuple()
info['listeners'] = [self._api_listener_as_tuple(l)
for l in check_elb.listeners]
elif self.status == 'created':
# When creating a new ELB, listeners don't show in the
@ -431,7 +431,7 @@ class ElbManager(object):
# Since ELB allows only one listener on each incoming port, a
# single match on the incomping port is all we're looking for
if existing_listener[0] == listener['load_balancer_port']:
existing_listener_found = existing_listener.get_complex_tuple()
existing_listener_found = self._api_listener_as_tuple(existing_listener)
break
if existing_listener_found:
@ -451,7 +451,7 @@ class ElbManager(object):
# Check for any extraneous listeners we need to remove, if desired
if self.purge_listeners:
for existing_listener in self.elb.listeners:
existing_listener_tuple = existing_listener.get_complex_tuple()
existing_listener_tuple = self._api_listener_as_tuple(existing_listener)
if existing_listener_tuple in listeners_to_remove:
# Already queued for removal
continue
@ -468,6 +468,13 @@ class ElbManager(object):
if listeners_to_add:
self._create_elb_listeners(listeners_to_add)
def _api_listener_as_tuple(self, listener):
"""Adds ssl_certificate_id to ELB API tuple if present"""
base_tuple = listener.get_complex_tuple()
if listener.ssl_certificate_id and len(base_tuple) < 5:
return base_tuple + (listener.ssl_certificate_id,)
return base_tuple
def _listener_as_tuple(self, listener):
"""Formats listener as a 4- or 5-tuples, in the order specified by the
ELB API"""