| Index: third_party/boto/bin/elbadmin
|
| ===================================================================
|
| --- third_party/boto/bin/elbadmin (revision 33376)
|
| +++ third_party/boto/bin/elbadmin (working copy)
|
| @@ -72,6 +72,10 @@
|
| for b in elb.get_all_load_balancers():
|
| print "%-20s %s" % (b.name, b.dns_name)
|
|
|
| +def check_valid_region(conn, region):
|
| + if conn is None:
|
| + print 'Invalid region (%s)' % region
|
| + sys.exit(1)
|
|
|
| def get(elb, name):
|
| """Get details about ELB <name>"""
|
| @@ -108,18 +112,20 @@
|
| print
|
|
|
| # Make map of all instance Id's to Name tags
|
| + import boto
|
| if not options.region:
|
| ec2 = boto.connect_ec2()
|
| else:
|
| - import boto.ec2.elb
|
| ec2 = boto.ec2.connect_to_region(options.region)
|
| + check_valid_region(ec2, options.region)
|
|
|
| instance_health = b.get_instance_health()
|
| instances = [state.instance_id for state in instance_health]
|
|
|
| - names = {}
|
| - for i in ec2.get_only_instances(instances):
|
| - names[i.id] = i.tags.get('Name', '')
|
| + names = dict((k,'') for k in instances)
|
| + for i in ec2.get_only_instances():
|
| + if i.id in instances:
|
| + names[i.id] = i.tags.get('Name', '')
|
|
|
| name_column_width = max([4] + [len(v) for k,v in names.iteritems()]) + 2
|
|
|
| @@ -254,6 +260,7 @@
|
| else:
|
| import boto.ec2.elb
|
| elb = boto.ec2.elb.connect_to_region(options.region)
|
| + check_valid_region(elb, options.region)
|
|
|
| print "%s" % (elb.region.endpoint)
|
|
|
|
|