From 4755bde28d05a8dcafe979e95bf2da937d180c16 Mon Sep 17 00:00:00 2001 From: Andres Silva Date: Fri, 17 Oct 2014 12:16:35 -0400 Subject: [PATCH] adding for loop on list to to handle the return of none when the list is empty. With the previous method if the list was empty the script died. See http://stackoverflow.com/questions/18852324/typeerror-sequence-item-0-expected-string-nonetype-found --- plugins/inventory/ec2.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/inventory/ec2.py b/plugins/inventory/ec2.py index aec6473be6..9d2dec38d3 100755 --- a/plugins/inventory/ec2.py +++ b/plugins/inventory/ec2.py @@ -622,8 +622,8 @@ class Ec2Inventory(object): for group in value: group_ids.append(group.id) group_names.append(group.name) - instance_vars["ec2_security_group_ids"] = ','.join(group_ids) - instance_vars["ec2_security_group_names"] = ','.join(group_names) + instance_vars["ec2_security_group_ids"] = ','.join([str(i) for i in group_ids]) + instance_vars["ec2_security_group_names"] = ','.join([str(i) for i in group_names]) else: pass # TODO Product codes if someone finds them useful