Skip to content
This repository has been archived by the owner on Jan 19, 2022. It is now read-only.

Commit

Permalink
Applied code review, simplified
Browse files Browse the repository at this point in the history
Removed JSON output
  • Loading branch information
Benedetto Lo Giudice committed Jul 23, 2015
1 parent ae37324 commit 08aaca2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
17 changes: 7 additions & 10 deletions bootstrap_cfn/elb.py
Expand Up @@ -101,14 +101,11 @@ def list_domain_names(self, stack_name):
"""
lb_name_dns = []
load_balancer_resources = self.cfn.get_stack_load_balancers(stack_name)
for l in load_balancer_resources:
lb_details = self.conn_elb.get_all_load_balancers(
load_balancer_names=[l.physical_resource_id])
if not len(lb_details) == 1:
raise BootstrapCfnError("Expected 1 DNS name received %d" % len(lb_details))
if not lb_details[0]:
raise BootstrapCfnError("No ELB DNS returned")
lb_name_dns.append({
'elb_name': l.physical_resource_id,
'dns_name': lb_details[0].dns_name})
lb_ids = [l.physical_resource_id for l in load_balancer_resources]
if not lb_ids:
raise BootstrapCfnError("No ELBs found for stack %s" % stack_name)
lbs_details = self.conn_elb.get_all_load_balancers(load_balancer_names=lb_ids)
if not lbs_details:
raise BootstrapCfnError("No ELBs details returned by AWS")
lb_name_dns = [{'elb_name': l.name, 'dns_name': l.dns_name} for l in lbs_details]
return lb_name_dns
3 changes: 1 addition & 2 deletions bootstrap_cfn/fab_tasks.py
Expand Up @@ -433,6 +433,5 @@ def display_elb_dns_entries():
abort("Could not retrieve stack_name")
elb = get_connection(ELB)
elb_dns_list = elb.list_domain_names(stack_name)
import json
for elb_dns in elb_dns_list:
print json.dumps(elb_dns, sort_keys=True, indent=4, separators=(',', ': '))
print "\n\nELB name: {0} DNS: {1}".format(elb_dns['elb_name'], elb_dns['dns_name'])

0 comments on commit 08aaca2

Please sign in to comment.