From 0254cbad9a77d79613e9f78b044df3c353fbd946 Mon Sep 17 00:00:00 2001 From: Dennis Conrad Date: Thu, 17 Mar 2016 17:08:40 +0000 Subject: [PATCH] Fix for existing ENIs w/ multiple security groups Do a sorted comparison of the list of security groups supplied via `module.params.get('security_groups')` and the list of security groups fetched via `get_sec_group_list(eni.groups)`. This fixes an incorrect "The specified address is already in use" error if the order of security groups in those lists differ. --- lib/ansible/modules/extras/cloud/amazon/ec2_eni.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/modules/extras/cloud/amazon/ec2_eni.py b/lib/ansible/modules/extras/cloud/amazon/ec2_eni.py index 94fd48bfd6b..50a48c15ab0 100644 --- a/lib/ansible/modules/extras/cloud/amazon/ec2_eni.py +++ b/lib/ansible/modules/extras/cloud/amazon/ec2_eni.py @@ -322,7 +322,7 @@ def compare_eni(connection, module): for eni in all_eni: remote_security_groups = get_sec_group_list(eni.groups) - if (eni.subnet_id == subnet_id) and (eni.private_ip_address == private_ip_address) and (eni.description == description) and (remote_security_groups == security_groups): + if (eni.subnet_id == subnet_id) and (eni.private_ip_address == private_ip_address) and (eni.description == description) and (sorted(remote_security_groups) == sorted(security_groups)): return eni except BotoServerError as e: