Merge "Handle a NeutronClientException 404 Error for floating ips"
This commit is contained in:
commit
3be51f19ae
@ -1468,7 +1468,11 @@ class API(base_api.NetworkAPI):
|
||||
# list_floatingips will be raised.
|
||||
except neutron_client_exc.NotFound:
|
||||
return []
|
||||
except neutron_client_exc.NeutronClientException:
|
||||
except neutron_client_exc.NeutronClientException as e:
|
||||
# bug/1513879 neutron client is currently using
|
||||
# NeutronClientException when there is no L3 API
|
||||
if e.status_code == 404:
|
||||
return []
|
||||
with excutils.save_and_reraise_exception():
|
||||
LOG.exception(_LE('Unable to access floating IP for %s'),
|
||||
', '.join(['%s %s' % (k, v)
|
||||
|
@ -3585,7 +3585,10 @@ class TestNeutronv2WithMock(test.TestCase):
|
||||
def test_get_floating_ips_by_project_not_found(self, mock_ntrn):
|
||||
mock_nc = mock.Mock()
|
||||
mock_ntrn.return_value = mock_nc
|
||||
mock_nc.list_floatingips.side_effect = exceptions.NotFound()
|
||||
# neutronclient doesn't raise NotFound in this scenario, it raises a
|
||||
# NeutronClientException with status_code=404
|
||||
notfound = exceptions.NeutronClientException(status_code=404)
|
||||
mock_nc.list_floatingips.side_effect = notfound
|
||||
fips = self.api.get_floating_ips_by_project(self.context)
|
||||
self.assertEqual([], fips)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user