mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
[cloud] only create new eni if none of the filters lead to one match (#22919)
This commit is contained in:
parent
dab0e75ce0
commit
f5f7a8c681
1 changed files with 1 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue