@@ -193,24 +193,25 @@ def get_multiple_instance_details(instance_ids, ec2=None):
193193 except botocore .exceptions .ClientError :
194194 raise AWSConnectionError
195195
196- instance_name = None
197196 instance_details = []
198197 for ec2_instance in ec2_instances :
198+ instance_name = None
199199 for tag in ec2_instance .tags :
200200 if tag ["Key" ] == "Name" :
201201 instance_name = tag ["Value" ]
202-
203- instance_details .append (
204- {
205- "instance_id" : ec2_instance .id ,
206- "instance_name" : instance_name ,
207- "availability_zone" : ec2_instance .placement ["AvailabilityZone" ],
208- "vpc_id" : ec2_instance .vpc_id ,
209- "private_ip_address" : ec2_instance .private_ip_address or None ,
210- "public_ip_address" : ec2_instance .public_ip_address or None ,
211- "private_dns_name" : ec2_instance .private_dns_name or None ,
212- "public_dns_name" : ec2_instance .public_dns_name or None ,
213- }
214- )
202+ break
203+
204+ instance_details .append (
205+ {
206+ "instance_id" : ec2_instance .id ,
207+ "instance_name" : instance_name ,
208+ "availability_zone" : ec2_instance .placement ["AvailabilityZone" ],
209+ "vpc_id" : ec2_instance .vpc_id ,
210+ "private_ip_address" : ec2_instance .private_ip_address or None ,
211+ "public_ip_address" : ec2_instance .public_ip_address or None ,
212+ "private_dns_name" : ec2_instance .private_dns_name or None ,
213+ "public_dns_name" : ec2_instance .public_dns_name or None ,
214+ }
215+ )
215216
216217 return instance_details
0 commit comments