mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00:00
[cloud] only create new eni if none of the filters lead to one match (#22919)
This commit is contained in:
committed by
Ryan Brown
parent
dab0e75ce0
commit
f5f7a8c681
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user