Skip to content

Commit f5f7a8c

Browse files
s-hertelryansb
authored andcommitted
[cloud] only create new eni if none of the filters lead to one match (ansible#22919)
1 parent dab0e75 commit f5f7a8c

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

lib/ansible/modules/cloud/amazon/ec2_eni.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -483,9 +483,6 @@ def find_eni(connection, module):
483483
instance_id = module.params.get('instance_id')
484484
device_index = module.params.get('device_index')
485485

486-
if not eni_id:
487-
return None
488-
489486
try:
490487
filters = {}
491488
if subnet_id:
@@ -499,7 +496,7 @@ def find_eni(connection, module):
499496
filters['attachment.device-index'] = device_index
500497

501498
eni_result = connection.get_all_network_interfaces(eni_id, filters=filters)
502-
if len(eni_result) > 0:
499+
if len(eni_result) == 1:
503500
return eni_result[0]
504501
else:
505502
return None

0 commit comments

Comments
 (0)