Fix wrapping of neutron forbidden error
In neutronv2 api, the neutron forbidden error is not wrapped
correctly. The exception class expects the first parameter as
the error message but an exception object is passed.
Closes-Bug: #1720726
Change-Id: I6e88333427ec2befe2122274b02775f013404e30
(cherry picked from commit f1a0557da4
)
This commit is contained in:
parent
708342fe8d
commit
837ac8c1d6
|
@ -127,7 +127,7 @@ class ClientWrapper(clientv20.Client):
|
|||
"admin credential located in nova.conf"))
|
||||
raise exception.NeutronAdminCredentialConfigurationInvalid()
|
||||
except neutron_client_exc.Forbidden as e:
|
||||
raise exception.Forbidden(e)
|
||||
raise exception.Forbidden(six.text_type(e))
|
||||
return ret
|
||||
return wrapper
|
||||
|
||||
|
|
|
@ -184,9 +184,10 @@ class TestNeutronClient(test.NoDBTestCase):
|
|||
auth_token='token',
|
||||
is_admin=False)
|
||||
client = neutronapi.get_client(my_context)
|
||||
self.assertRaises(
|
||||
exc = self.assertRaises(
|
||||
exception.Forbidden,
|
||||
client.create_port)
|
||||
self.assertIsInstance(exc.format_message(), six.text_type)
|
||||
|
||||
def test_withtoken_context_is_admin(self):
|
||||
self.flags(url='http://anyhost/', group='neutron')
|
||||
|
|
Loading…
Reference in New Issue