mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
ec2 inventory: Verify that a security group exists before trying to use its name as a key in inventory.
This commit is contained in:
parent
20a57dcdcb
commit
c2f8215c06
1 changed files with 3 additions and 2 deletions
|
@ -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.'
|
||||
|
|
Loading…
Reference in a new issue