This commit is contained in:
parent
963cb64337
commit
c053fa5378
1 changed files with 22 additions and 8 deletions
|
@ -1076,10 +1076,14 @@ class ElbManager(object):
|
||||||
|
|
||||||
def _get_backend_policies(self):
|
def _get_backend_policies(self):
|
||||||
"""Get a list of backend policies"""
|
"""Get a list of backend policies"""
|
||||||
return [
|
policies = []
|
||||||
str(backend.instance_port) + ':' + policy.policy_name for backend in self.elb.backends
|
if self.elb.backends is not None:
|
||||||
for policy in backend.policies
|
for backend in self.elb.backends:
|
||||||
]
|
if backend.policies is not None:
|
||||||
|
for policy in backend.policies:
|
||||||
|
policies.append(str(backend.instance_port) + ':' + policy.policy_name)
|
||||||
|
|
||||||
|
return policies
|
||||||
|
|
||||||
def _set_backend_policies(self):
|
def _set_backend_policies(self):
|
||||||
"""Sets policies for all backends"""
|
"""Sets policies for all backends"""
|
||||||
|
@ -1112,6 +1116,7 @@ class ElbManager(object):
|
||||||
|
|
||||||
def _get_proxy_protocol_policy(self):
|
def _get_proxy_protocol_policy(self):
|
||||||
"""Find out if the elb has a proxy protocol enabled"""
|
"""Find out if the elb has a proxy protocol enabled"""
|
||||||
|
if self.elb.policies is not None and self.elb.policies.other_policies is not None:
|
||||||
for policy in self.elb.policies.other_policies:
|
for policy in self.elb.policies.other_policies:
|
||||||
if policy.policy_name == 'ProxyProtocol-policy':
|
if policy.policy_name == 'ProxyProtocol-policy':
|
||||||
return policy.policy_name
|
return policy.policy_name
|
||||||
|
@ -1135,11 +1140,20 @@ class ElbManager(object):
|
||||||
b = set(b)
|
b = set(b)
|
||||||
return [aa for aa in a if aa not in b]
|
return [aa for aa in a if aa not in b]
|
||||||
|
|
||||||
|
def _get_instance_ids(self):
|
||||||
|
"""Get the current list of instance ids installed in the elb"""
|
||||||
|
instances = []
|
||||||
|
if self.elb.instances is not None:
|
||||||
|
for instance in self.elb.instances:
|
||||||
|
instances.append(instance.id)
|
||||||
|
|
||||||
|
return instances
|
||||||
|
|
||||||
def _set_instance_ids(self):
|
def _set_instance_ids(self):
|
||||||
"""Register or deregister instances from an lb instance"""
|
"""Register or deregister instances from an lb instance"""
|
||||||
assert_instances = self.instance_ids or []
|
assert_instances = self.instance_ids or []
|
||||||
|
|
||||||
has_instances = [has_instance.id for has_instance in self.elb.instances]
|
has_instances = self._get_instance_ids()
|
||||||
|
|
||||||
add_instances = self._diff_list(assert_instances, has_instances)
|
add_instances = self._diff_list(assert_instances, has_instances)
|
||||||
if add_instances:
|
if add_instances:
|
||||||
|
|
Loading…
Reference in a new issue