From 39efcd076677ab8fb15b4a0794287a44a013503f Mon Sep 17 00:00:00 2001 From: Peter Sankauskas Date: Wed, 7 Nov 2012 16:56:45 -0800 Subject: [PATCH] While I haven't done this, it is possible to bring up an instance without a keypair, so this takes care of that scenario --- plugins/inventory/ec2.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/inventory/ec2.py b/plugins/inventory/ec2.py index 9e87b0a5a31..7ac3aa96191 100755 --- a/plugins/inventory/ec2.py +++ b/plugins/inventory/ec2.py @@ -303,7 +303,8 @@ class Ec2Inventory(object): self.push(self.inventory, self.to_safe('type_' + instance.instance_type), dest) # Inventory: Group by key pair - self.push(self.inventory, self.to_safe('key_' + instance.key_name), dest) + if instance.key_name != None: + self.push(self.inventory, self.to_safe('key_' + instance.key_name), dest) # Inventory: Group by security group try: