Merge "Fix wrapping of neutron forbidden error"

This commit is contained in:
Zuul 2017-11-14 12:37:14 +00:00 committed by Gerrit Code Review
commit 50c23d8c86
2 changed files with 3 additions and 2 deletions
nova
network/neutronv2
tests/unit/network

@ -127,7 +127,7 @@ class ClientWrapper(clientv20.Client):
"admin credential located in nova.conf") "admin credential located in nova.conf")
raise exception.NeutronAdminCredentialConfigurationInvalid() raise exception.NeutronAdminCredentialConfigurationInvalid()
except neutron_client_exc.Forbidden as e: except neutron_client_exc.Forbidden as e:
raise exception.Forbidden(e) raise exception.Forbidden(six.text_type(e))
return ret return ret
return wrapper return wrapper

@ -181,9 +181,10 @@ class TestNeutronClient(test.NoDBTestCase):
auth_token='token', auth_token='token',
is_admin=False) is_admin=False)
client = neutronapi.get_client(my_context) client = neutronapi.get_client(my_context)
self.assertRaises( exc = self.assertRaises(
exception.Forbidden, exception.Forbidden,
client.create_port) client.create_port)
self.assertIsInstance(exc.format_message(), six.text_type)
def test_withtoken_context_is_admin(self): def test_withtoken_context_is_admin(self):
self.flags(url='http://anyhost/', group='neutron') self.flags(url='http://anyhost/', group='neutron')