From 1ed5f50d56a645a3c04090b29e8264d1d77e7a7b Mon Sep 17 00:00:00 2001 From: Oleksandr Shulgin Date: Mon, 14 Dec 2015 12:38:10 +0100 Subject: [PATCH 1/2] Fix ELB.describe_tags with multiple LoadBalancerNames. --- moto/elb/responses.py | 9 +++++++-- tests/test_elb/test_elb.py | 20 ++++++++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/moto/elb/responses.py b/moto/elb/responses.py index 0ed230afd..934bfaef0 100644 --- a/moto/elb/responses.py +++ b/moto/elb/responses.py @@ -277,6 +277,7 @@ class ELBResponse(BaseResponse): return template.render() def describe_tags(self): + elbs = [] for key, value in self.querystring.items(): if "LoadBalancerNames.member" in key: number = key.split('.')[2] @@ -284,9 +285,10 @@ class ELBResponse(BaseResponse): elb = self.elb_backend.get_load_balancer(load_balancer_name) if not elb: raise LoadBalancerNotFound(load_balancer_name) + elbs.append(elb) template = self.response_template(DESCRIBE_TAGS_TEMPLATE) - return template.render(tags=elb.tags) + return template.render(load_balancers=elbs) ADD_TAGS_TEMPLATE = """ @@ -305,9 +307,11 @@ REMOVE_TAGS_TEMPLATE = """ + {% for elb in load_balancers %} + {{ elb.name }} - {% for key, value in tags.items() %} + {% for key, value in elb.tags.items() %} {{ value }} {{ key }} @@ -315,6 +319,7 @@ DESCRIBE_TAGS_TEMPLATE = """