summaryrefslogtreecommitdiff
path: root/lib/ansible/modules/cloud/amazon
diff options
context:
space:
mode:
authorSloane Hertel <shertel@redhat.com>2017-03-30 14:55:31 -0400
committerRyan Brown <sb@ryansb.com>2017-03-30 14:55:31 -0400
commitf5f7a8c681c486c94c697173c7b4f50e6db6664b (patch)
tree4e1252867aa069bf78dca81da86cb41be74e61fb /lib/ansible/modules/cloud/amazon
parentdab0e75ce0a1cf02443818dbf0a0ae6478302dbb (diff)
downloadansible-f5f7a8c681c486c94c697173c7b4f50e6db6664b.tar.gz
[cloud] only create new eni if none of the filters lead to one match (#22919)
Diffstat (limited to 'lib/ansible/modules/cloud/amazon')
-rw-r--r--lib/ansible/modules/cloud/amazon/ec2_eni.py5
1 files changed, 1 insertions, 4 deletions
diff --git a/lib/ansible/modules/cloud/amazon/ec2_eni.py b/lib/ansible/modules/cloud/amazon/ec2_eni.py
index dbc136f8ba..37dde52d25 100644
--- a/lib/ansible/modules/cloud/amazon/ec2_eni.py
+++ b/lib/ansible/modules/cloud/amazon/ec2_eni.py
@@ -483,9 +483,6 @@ def find_eni(connection, module):
instance_id = module.params.get('instance_id')
device_index = module.params.get('device_index')
- if not eni_id:
- return None
-
try:
filters = {}
if subnet_id:
@@ -499,7 +496,7 @@ def find_eni(connection, module):
filters['attachment.device-index'] = device_index
eni_result = connection.get_all_network_interfaces(eni_id, filters=filters)
- if len(eni_result) > 0:
+ if len(eni_result) == 1:
return eni_result[0]
else:
return None