1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

fixed whitespace and added a comment to explain if statement

This commit is contained in:
jclaybaugh 2013-06-07 18:25:14 +00:00
parent 4733dc6b5b
commit f4db6d1a91

View file

@ -245,9 +245,10 @@ class Ec2Inventory(object):
else:
conn = ec2.connect_to_region(region)
if conn is None:
print("AWS is down or region name: %s likely not supported. connection to region failed." % region)
sys.exit(1)
# connect_to_region will fail "silently" by returning None if the region name is wrong or not supported
if conn is None:
print("region name: %s likely not supported, or AWS is down. connection to region failed." % region)
sys.exit(1)
reservations = conn.get_all_instances()
for reservation in reservations:
@ -283,9 +284,10 @@ class Ec2Inventory(object):
else:
conn = ec2.connect_to_region(region)
# connect_to_region will fail "silently" by returning None if the region name is wrong or not supported
if conn is None:
print("AWS is down or region name: %s likely not supported. connection to region failed." % region)
sys.exit(1)
print("region name: %s likely not supported, or AWS is down. connection to region failed." % region)
sys.exit(1)
reservations = conn.get_all_instances([instance_id])
for reservation in reservations: