From faeccb4e61d7e9e54ab608a259a18a6d28469d50 Mon Sep 17 00:00:00 2001 From: Matthew Jones Date: Thu, 29 Oct 2015 13:24:39 -0400 Subject: [PATCH] Fix ec2 infinitely nested groups The ec2 inventory module will incorrectly place parent groups as child groups of themselves, this fixes that. --- contrib/inventory/ec2.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/contrib/inventory/ec2.py b/contrib/inventory/ec2.py index 822220b0721..b8b1d43deac 100755 --- a/contrib/inventory/ec2.py +++ b/contrib/inventory/ec2.py @@ -703,7 +703,8 @@ class Ec2Inventory(object): self.push(self.inventory, key, dest) if self.nested_groups: self.push_group(self.inventory, 'tags', self.to_safe("tag_" + k)) - self.push_group(self.inventory, self.to_safe("tag_" + k), key) + if v: + self.push_group(self.inventory, self.to_safe("tag_" + k), key) # Inventory: Group by Route53 domain names if enabled if self.route53_enabled and self.group_by_route53_names: @@ -1309,3 +1310,4 @@ class Ec2Inventory(object): # Run the script Ec2Inventory() +