Beispiel #1
0
    def test_list_floating_ips_with_filters(self, mock_has_service,
                                            mock_neutron_client):
        mock_neutron_client.list_floatingips.side_effect = \
            exc.OpenStackCloudURINotFound("")

        try:
            self.cloud.list_floating_ips(filters={'Foo': 42})
        except exc.OpenStackCloudException as e:
            self.assertIsInstance(e.inner_exception[1],
                                  exc.OpenStackCloudURINotFound)

        mock_neutron_client.list_floatingips.assert_called_once_with(Foo=42)
Beispiel #2
0
def neutron_exceptions(error_message):
    try:
        yield
    except neutron_exc.NotFound as e:
        raise exc.OpenStackCloudResourceNotFound("{msg}: {exc}".format(
            msg=error_message, exc=str(e)))
    except neutron_exc.NeutronClientException as e:
        if e.status_code == 404:
            raise exc.OpenStackCloudURINotFound("{msg}: {exc}".format(
                msg=error_message, exc=str(e)))
        else:
            raise exc.OpenStackCloudException("{msg}: {exc}".format(
                msg=error_message, exc=str(e)))
    except Exception as e:
        raise exc.OpenStackCloudException("{msg}: {exc}".format(
            msg=error_message, exc=str(e)))