Use keystone v3 session with novaclient
Keystone v2.0 is removed so we have to use keystone v3. Use already defined keystone v3 session for creating novaclient instance. Also, remove the version check for novaclient 6 as we now having novaclient >9.0.0. Change-Id: I4a98e9dad0e2a7601145c9155191c876f920abfd Closes-Bug: #1721366
This commit is contained in:
parent
99319f9ec3
commit
2d72ba5117
@ -696,6 +696,7 @@ class TestPostConfig(base.BaseTestCase):
|
||||
@mock.patch('instack_undercloud.undercloud._migrate_to_convergence')
|
||||
@mock.patch('instack_undercloud.undercloud._ensure_node_resource_classes')
|
||||
@mock.patch('instack_undercloud.undercloud._member_role_exists')
|
||||
@mock.patch('instack_undercloud.undercloud._get_session')
|
||||
@mock.patch('ironicclient.client.get_client', autospec=True)
|
||||
@mock.patch('novaclient.client.Client', autospec=True)
|
||||
@mock.patch('swiftclient.client.Connection', autospec=True)
|
||||
@ -710,8 +711,9 @@ class TestPostConfig(base.BaseTestCase):
|
||||
mock_configure_ssh_keys, mock_get_auth_values,
|
||||
mock_copy_stackrc, mock_delete, mock_mistral_client,
|
||||
mock_swift_client, mock_nova_client, mock_ir_client,
|
||||
mock_member_role_exists, mock_resource_classes,
|
||||
mock_migrate_to_convergence, mock_make_client):
|
||||
mock_get_session, mock_member_role_exists,
|
||||
mock_resource_classes, mock_migrate_to_convergence,
|
||||
mock_make_client):
|
||||
instack_env = {
|
||||
'UNDERCLOUD_ENDPOINT_MISTRAL_PUBLIC':
|
||||
'http://192.168.24.1:8989/v2',
|
||||
@ -720,6 +722,7 @@ class TestPostConfig(base.BaseTestCase):
|
||||
'http://bletchley:5000/')
|
||||
mock_instance_nova = mock.Mock()
|
||||
mock_nova_client.return_value = mock_instance_nova
|
||||
mock_get_session.return_value = mock.MagicMock()
|
||||
mock_instance_swift = mock.Mock()
|
||||
mock_swift_client.return_value = mock_instance_swift
|
||||
mock_instance_mistral = mock.Mock()
|
||||
@ -737,8 +740,7 @@ class TestPostConfig(base.BaseTestCase):
|
||||
|
||||
undercloud._post_config(instack_env, True)
|
||||
mock_nova_client.assert_called_with(
|
||||
2, 'aturing', '3nigma', project_name='hut8',
|
||||
auth_url='http://bletchley:5000/')
|
||||
2, session=mock_get_session.return_value)
|
||||
self.assertTrue(mock_copy_stackrc.called)
|
||||
mock_configure_ssh_keys.assert_called_with(mock_instance_nova)
|
||||
calls = [mock.call(mock_instance_nova, flavors[0], 'baremetal', None),
|
||||
|
@ -38,7 +38,6 @@ from keystoneclient import discover
|
||||
import keystoneauth1.identity.generic as ks_auth
|
||||
from mistralclient.api import base as mistralclient_base
|
||||
from mistralclient.api import client as mistralclient
|
||||
import novaclient as nc
|
||||
from novaclient import client as novaclient
|
||||
from novaclient import exceptions
|
||||
import os_client_config
|
||||
@ -1681,12 +1680,7 @@ def _post_config(instack_env, upgrade):
|
||||
_copy_stackrc()
|
||||
user, password, project, auth_url = _get_auth_values()
|
||||
sess = _get_session()
|
||||
# TODO(andreykurilin): remove this check with support of novaclient 6.0.0
|
||||
if nc.__version__[0] == "6":
|
||||
nova = novaclient.Client(2, user, password, project, auth_url=auth_url)
|
||||
else:
|
||||
nova = novaclient.Client(2, user, password, auth_url=auth_url,
|
||||
project_name=project)
|
||||
nova = novaclient.Client(2, session=sess)
|
||||
|
||||
ironic = ir_client.get_client(1, session=sess,
|
||||
os_ironic_api_version='1.21')
|
||||
|
Loading…
Reference in New Issue
Block a user