Fix keystone client usage in barbican client

In magnum.common.clients, barbican client uses
`keystone()._client` directly, but `keystone().client`
is better. Because, keystone()._client is None is it
is not loaded.

This fixes it.

Closes-Bug: #1491257
Change-Id: I3771ebef9c2a1d3756ea4ed2f964751d1c2da43f
This commit is contained in:
OTSUKA, Yuanying 2015-09-02 13:24:45 +09:00
parent 4abd2f128b
commit 77d1e32c94
2 changed files with 4 additions and 4 deletions

View File

@ -182,7 +182,7 @@ class OpenStackClients(object):
endpoint = self.url_for(service_type='key-manager',
endpoint_type=endpoint_type,
region_name=region_name)
session = self.keystone()._client.session
session = self.keystone().client.session
self._barbican = barbicanclient.Client(session=session,
endpoint=endpoint)

View File

@ -169,14 +169,14 @@ class ClientsTest(base.BaseTestCase):
con.auth_url = "keystone_url"
mock_url.return_value = "url_from_keystone"
keystone = mock.MagicMock()
keystone._client.session = mock.MagicMock()
keystone.client.session = mock.MagicMock()
mock_keystone.return_value = keystone
obj = clients.OpenStackClients(con)
obj._barbican = None
obj.barbican()
mock_call.assert_called_once_with(
endpoint='url_from_keystone',
session=keystone._client.session)
session=keystone.client.session)
mock_keystone.assert_called_once_with()
mock_url.assert_called_once_with(service_type='key-manager',
@ -211,7 +211,7 @@ class ClientsTest(base.BaseTestCase):
con.auth_url = "keystone_url"
mock_url.return_value = "url_from_keystone"
keystone = mock.MagicMock()
keystone._client.session = mock.MagicMock()
keystone.client.session = mock.MagicMock()
mock_keystone.return_value = keystone
obj = clients.OpenStackClients(con)
obj._barbican = None