Cleanup querying missing ELB error.
This commit is contained in:
parent
2e69986e01
commit
5d421dc343
5 changed files with 30 additions and 7 deletions
|
|
@ -10,7 +10,7 @@ from boto.ec2.elb.attributes import (
|
|||
)
|
||||
from boto.ec2.elb.policies import Policies
|
||||
from moto.core import BaseBackend
|
||||
from .exceptions import TooManyTagsError
|
||||
from .exceptions import LoadBalancerNotFoundError, TooManyTagsError
|
||||
|
||||
|
||||
class FakeHealthCheck(object):
|
||||
|
|
@ -139,7 +139,7 @@ class FakeLoadBalancer(object):
|
|||
|
||||
def list_tags(self):
|
||||
return self.tags
|
||||
|
||||
|
||||
def remove_tag(self, key):
|
||||
if key in self.tags:
|
||||
del self.tags[key]
|
||||
|
|
@ -174,7 +174,11 @@ class ELBBackend(BaseBackend):
|
|||
def describe_load_balancers(self, names):
|
||||
balancers = self.load_balancers.values()
|
||||
if names:
|
||||
return [balancer for balancer in balancers if balancer.name in names]
|
||||
matched_balancers = [balancer for balancer in balancers if balancer.name in names]
|
||||
if len(names) != len(matched_balancers):
|
||||
missing_elb = list(set(names) - set(matched_balancers))[0]
|
||||
raise LoadBalancerNotFoundError(missing_elb)
|
||||
return matched_balancers
|
||||
else:
|
||||
return balancers
|
||||
|
||||
|
|
|
|||
|
|
@ -245,7 +245,7 @@ class ELBResponse(BaseResponse):
|
|||
for i in tag_keys:
|
||||
counts[i] = tag_keys.count(i)
|
||||
|
||||
counts = sorted(counts.items(), key=lambda i:i[1], reverse=True)
|
||||
counts = sorted(counts.items(), key=lambda i:i[1], reverse=True)
|
||||
|
||||
if counts and counts[0][1] > 1:
|
||||
# We have dupes...
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue