From c2f8215c06dd7167262e1353aab51a789ed030d3 Mon Sep 17 00:00:00 2001 From: Herby Gillot Date: Thu, 22 Aug 2013 15:45:31 -0400 Subject: [PATCH] ec2 inventory: Verify that a security group exists before trying to use its name as a key in inventory. --- plugins/inventory/ec2.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/inventory/ec2.py b/plugins/inventory/ec2.py index 9a2505feb2c..eb1d6595f6e 100755 --- a/plugins/inventory/ec2.py +++ b/plugins/inventory/ec2.py @@ -384,8 +384,9 @@ class Ec2Inventory(object): # Inventory: Group by security group try: - key = self.to_safe("security_group_" + instance.security_group.name) - self.push(self.inventory, key, dest) + if instance.security_group: + key = self.to_safe("security_group_" + instance.security_group.name) + self.push(self.inventory, key, dest) except AttributeError: print 'Package boto seems a bit older.' print 'Please upgrade boto >= 2.3.0.'