Fix compatibility with novaclient 7.0.0
Recent update of upper-constraints for novaclient 7.0.0 in [1] breaked magnum. This patch makes magnum code compatible with latest release. Also, passed endpoint_override while class Initialization to remove warning [2]:- [1] https://review.openstack.org/#/c/414170/ [2] Property `management_url` is deprecated for SessionClient. It should be set via `endpoint_override` variable while class initialization. Change-Id: Idc0e501c23b77ed5b4e9e9e7a6a7b6af7c7bca75 Closes-Bug: #1658058 Closes-Bug: #1658005
This commit is contained in:
parent
0c0438b5f1
commit
203ce78b7a
@ -165,9 +165,10 @@ class OpenStackClients(object):
|
|||||||
'insecure': self._get_client_option('nova', 'insecure')
|
'insecure': self._get_client_option('nova', 'insecure')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
session = self.keystone().session
|
||||||
self._nova = novaclient.Client(novaclient_version,
|
self._nova = novaclient.Client(novaclient_version,
|
||||||
auth_token=self.auth_token, **args)
|
session=session,
|
||||||
self._nova.client.management_url = endpoint
|
endpoint_override=endpoint, **args)
|
||||||
return self._nova
|
return self._nova
|
||||||
|
|
||||||
@exception.wrap_keystone_exception
|
@exception.wrap_keystone_exception
|
||||||
|
@ -232,21 +232,27 @@ class ClientsTest(base.BaseTestCase):
|
|||||||
self.assertEqual(barbican, barbican_cached)
|
self.assertEqual(barbican, barbican_cached)
|
||||||
|
|
||||||
@mock.patch.object(novaclient, 'Client')
|
@mock.patch.object(novaclient, 'Client')
|
||||||
|
@mock.patch.object(clients.OpenStackClients, 'keystone')
|
||||||
@mock.patch.object(clients.OpenStackClients, 'url_for')
|
@mock.patch.object(clients.OpenStackClients, 'url_for')
|
||||||
@mock.patch.object(clients.OpenStackClients, 'auth_url')
|
@mock.patch.object(clients.OpenStackClients, 'auth_url')
|
||||||
def _test_clients_nova(self, expected_region_name, mock_auth, mock_url,
|
def _test_clients_nova(self, expected_region_name, mock_auth, mock_url,
|
||||||
mock_call):
|
mock_keystone, mock_call):
|
||||||
mock_auth.__get__ = mock.Mock(return_value="keystone_url")
|
mock_auth.__get__ = mock.Mock(return_value="keystone_url")
|
||||||
con = mock.MagicMock()
|
con = mock.MagicMock()
|
||||||
con.auth_token = "3bcc3d3a03f44e3d8377f9247b0ad155"
|
keystone = mock.MagicMock()
|
||||||
|
keystone.session = mock.MagicMock()
|
||||||
|
mock_keystone.return_value = keystone
|
||||||
con.auth_url = "keystone_url"
|
con.auth_url = "keystone_url"
|
||||||
mock_url.return_value = "url_from_keystone"
|
mock_url.return_value = "url_from_keystone"
|
||||||
obj = clients.OpenStackClients(con)
|
obj = clients.OpenStackClients(con)
|
||||||
obj._nova = None
|
obj._nova = None
|
||||||
obj.nova()
|
obj.nova()
|
||||||
|
expected_kwargs = {'session': keystone.session,
|
||||||
|
'endpoint_override': mock_url.return_value,
|
||||||
|
'cacert': None,
|
||||||
|
'insecure': False}
|
||||||
mock_call.assert_called_once_with(CONF.nova_client.api_version,
|
mock_call.assert_called_once_with(CONF.nova_client.api_version,
|
||||||
auth_token=con.auth_token,
|
**expected_kwargs)
|
||||||
cacert=None, insecure=False)
|
|
||||||
mock_url.assert_called_once_with(service_type='compute',
|
mock_url.assert_called_once_with(service_type='compute',
|
||||||
interface='publicURL',
|
interface='publicURL',
|
||||||
region_name=expected_region_name)
|
region_name=expected_region_name)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user