Do not raise invalid message when port does not exist

The exception handling for port, floating IP's or networks
is too broad. Add specific error handling and in a case when
the resource is not found do not raise a invalid message.

Change-Id: I98ee2ff816c03980645752eebb4e39d3ecd2e158
Closes-bug: #1796565
This commit is contained in:
Gary Kotton 2018-10-07 07:03:07 -07:00
parent f18843cbbc
commit 4ae8850dec
1 changed files with 3 additions and 0 deletions

View File

@ -1716,6 +1716,9 @@ def servers_update_addresses(request, servers, all_tenants=False):
networks = list_resources_with_long_filters(
network_list, 'id', frozenset([port.network_id for port in ports]),
request=request)
except neutron_exc.NotFound as e:
LOG.error('Neutron resource does not exist. %s', e)
return
except Exception as e:
LOG.error('Unable to connect to Neutron: %s', e)
error_message = _('Unable to connect to Neutron.')