From 8ae30f1822cb73ac54eb9e19d922d605a78ed098 Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Mon, 23 Nov 2015 16:23:41 -0800 Subject: [PATCH] Minor simplification of code --- cloud/amazon/ec2.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cloud/amazon/ec2.py b/cloud/amazon/ec2.py index 6dcc97bc5c8..e035e07af24 100644 --- a/cloud/amazon/ec2.py +++ b/cloud/amazon/ec2.py @@ -891,9 +891,9 @@ def create_instances(module, ec2, vpc, override_count=None): grp_details = ec2.get_all_security_groups() if isinstance(group_name, basestring): group_name = [group_name] - unmatched = list(set(group_name) - set([str(grp.name) for grp in grp_details])) + unmatched = set(group_name).difference(str(grp.name) for grp in grp_details) if len(unmatched) > 0: - module.fail_json(msg="the following group names are not valid: %s" % ','.join(unmatched)) + module.fail_json(msg="The following group names are not valid: %s" % ', '.join(unmatched)) group_id = [ str(grp.id) for grp in grp_details if str(grp.name) in group_name ] # Now we try to lookup the group id testing if group exists. elif group_id: