From a0e8b9ef98d63dc8a262976e50d9c36e300c4713 Mon Sep 17 00:00:00 2001 From: Marc Tamsky Date: Tue, 16 Jun 2015 19:28:53 -0700 Subject: [PATCH] for tags with empty value, do not append separator --- plugins/inventory/ec2.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/inventory/ec2.py b/plugins/inventory/ec2.py index 16ac93f5ee4..112f5c29e86 100755 --- a/plugins/inventory/ec2.py +++ b/plugins/inventory/ec2.py @@ -520,7 +520,10 @@ class Ec2Inventory(object): # Inventory: Group by tag keys if self.group_by_tag_keys: for k, v in instance.tags.items(): - key = self.to_safe("tag_" + k + "=" + v) + if v: + key = self.to_safe("tag_" + k + "=" + v) + else: + key = self.to_safe("tag_" + k) self.push(self.inventory, key, dest) if self.nested_groups: self.push_group(self.inventory, 'tags', self.to_safe("tag_" + k))