mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-29 11:40:22 -07: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')
|
instance_id = module.params.get('instance_id')
|
||||||
device_index = module.params.get('device_index')
|
device_index = module.params.get('device_index')
|
||||||
|
|
||||||
if not eni_id:
|
|
||||||
return None
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
filters = {}
|
filters = {}
|
||||||
if subnet_id:
|
if subnet_id:
|
||||||
|
@ -499,7 +496,7 @@ def find_eni(connection, module):
|
||||||
filters['attachment.device-index'] = device_index
|
filters['attachment.device-index'] = device_index
|
||||||
|
|
||||||
eni_result = connection.get_all_network_interfaces(eni_id, filters=filters)
|
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]
|
return eni_result[0]
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue