ec2 inventory: Verify that a security group exists before trying to use its name as a key in inventory.

This commit is contained in:
Herby Gillot 2013-08-22 15:45:31 -04:00 committed by James Cammarata
parent 20a57dcdcb
commit c2f8215c06

View file

@ -384,8 +384,9 @@ class Ec2Inventory(object):
# Inventory: Group by security group # Inventory: Group by security group
try: try:
key = self.to_safe("security_group_" + instance.security_group.name) if instance.security_group:
self.push(self.inventory, key, dest) key = self.to_safe("security_group_" + instance.security_group.name)
self.push(self.inventory, key, dest)
except AttributeError: except AttributeError:
print 'Package boto seems a bit older.' print 'Package boto seems a bit older.'
print 'Please upgrade boto >= 2.3.0.' print 'Please upgrade boto >= 2.3.0.'