Use trustee project_name instead of fixed value
Currently, when the default project name for openstack services is not "service", it will fail when listing protectable resources. This patch using trustee.project_name to replace it. Story: 2006797 Task: 37343 Change-Id: I8be62bb00e70dacd174e7fa3bd65489fb63488ab
This commit is contained in:
parent
08cef4fae6
commit
82f07c14b6
|
@ -54,9 +54,6 @@ class KarborKeystonePlugin(object):
|
|||
self._auth_uri = None
|
||||
self._karbor_user_id = None
|
||||
auth_plugin = self._get_karbor_auth_plugin()
|
||||
# set the project which karbor belongs to
|
||||
auth_plugin._project_name = "service"
|
||||
auth_plugin._project_domain_id = "default"
|
||||
self._service_auth_plugin = auth_plugin
|
||||
|
||||
@property
|
||||
|
|
|
@ -16,11 +16,23 @@ import mock
|
|||
from karbor.common import karbor_keystone_plugin
|
||||
from karbor.tests import base
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_config import fixture
|
||||
|
||||
|
||||
class KarborKeystonePluginTest(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(KarborKeystonePluginTest, self).setUp()
|
||||
plugin_config = cfg.ConfigOpts()
|
||||
plugin_config_fixture = self.useFixture(fixture.Config(plugin_config))
|
||||
plugin_config_fixture.load_raw_values(
|
||||
group='trustee',
|
||||
poll_interval=0,
|
||||
)
|
||||
cfg.CONF.set_default('project_name',
|
||||
'services',
|
||||
"trustee")
|
||||
self.kc_plugin = karbor_keystone_plugin.KarborKeystonePlugin()
|
||||
self.kc_plugin.client.services.list = mock.MagicMock()
|
||||
self.kc_plugin.client.endpoints.list = mock.MagicMock()
|
||||
|
@ -46,3 +58,7 @@ class KarborKeystonePluginTest(base.TestCase):
|
|||
service_type='data-protect',
|
||||
base_url='http://192.168.1.1/identity/v3'
|
||||
)
|
||||
|
||||
def test_service_auth_plugin_with_project_name(self):
|
||||
self.assertEqual(self.kc_plugin.service_auth_plugin._project_name,
|
||||
'services')
|
||||
|
|
Loading…
Reference in New Issue