Fix internal error when floating ip network is not found by name

Ensure that the appropriate exception (NotFoundException) is raised
in case the network is not found by the specified name, to avoid ugly
TypeError raised from internal logic.

Closes-Bug: #2080859
Co-Authored-By: Alexander Stepanov <astepanov2007@gmail.com>
Change-Id: I12ee35c1fc1bd9691b230f0b5e3de9111f0d46a7
This commit is contained in:
Takashi Kajinami 2024-09-17 00:55:57 +09:00
parent de07fd0263
commit b119c1be6d

View File

@ -806,7 +806,9 @@ class NetworkCommonCloudMixin(openstackcloud._OpenStackCloudMixin):
if not network_id:
if network_name_or_id:
try:
network = self.network.find_network(network_name_or_id)
network = self.network.find_network(
network_name_or_id, ignore_missing=False
)
except exceptions.NotFoundException:
raise exceptions.NotFoundException(
"unable to find network for floating ips with ID "