Fix initialization of novaclient

projectid argument of novaclient's(< 7.0) entry-point had several meaning
in case of different cases. It is not a user-friendly behaviour, so it was
fixed in 7.0 . Now projectid means project/tenant id in terms of keystone,
like it should be from the beginning.

tenant/project name should be transmitted viaa project_name or tenant_name
keyword argument.

Closes-Bug: #1654183
Change-Id: I106ee603e0853bbc2da4b99724e83587de3cb4ba
This commit is contained in:
Andrey Kurilin 2017-02-01 01:52:16 +02:00 committed by Emilien Macchi
parent 7110e24453
commit 0b02f1478a
2 changed files with 10 additions and 3 deletions

View File

@ -596,8 +596,9 @@ class TestPostConfig(base.BaseTestCase):
mock_instance_mistral = mock.Mock()
mock_mistral_client.return_value = mock_instance_mistral
undercloud._post_config(instack_env)
mock_nova_client.assert_called_with(2, 'aturing', '3nigma', 'hut8',
'http://bletchley:5000/v2.0')
mock_nova_client.assert_called_with(
2, 'aturing', '3nigma', project_name='hut8',
auth_url='http://bletchley:5000/v2.0')
self.assertTrue(mock_copy_stackrc.called)
mock_configure_ssh_keys.assert_called_with(mock_instance)
calls = [mock.call(mock_instance, 'baremetal'),

View File

@ -36,6 +36,7 @@ from keystoneclient import session
from keystoneclient import discover
from mistralclient.api import client as mistralclient
from mistralclient.api import base as mistralclient_base
import novaclient as nc
from novaclient import client as novaclient
from novaclient import exceptions
from oslo_config import cfg
@ -1237,7 +1238,12 @@ def _post_config_mistral(instack_env, mistral):
def _post_config(instack_env):
_copy_stackrc()
user, password, tenant, auth_url = _get_auth_values()
nova = novaclient.Client(2, user, password, tenant, auth_url)
# TODO(andreykurilin): remove this check with support of novaclient 6.0.0
if nc.__version__[0] == "6":
nova = novaclient.Client(2, user, password, tenant, auth_url=auth_url)
else:
nova = novaclient.Client(2, user, password, auth_url=auth_url,
project_name=tenant)
_configure_ssh_keys(nova)
_delete_default_flavors(nova)