Do not use inner class of glanceclient
When initiate glanceclient, we should use 'glanceclient.client.Client' instead of inner class 'glanceclient.v2.client.Client' [1] http://docs.openstack.org/developer/python-glanceclient/ref/ client.html Change-Id: I65036aaac255264ae598e6166a0fd8ae25ed0e2d Closes-Bug: #1533550
This commit is contained in:
parent
6748e5260e
commit
8176eb92db
|
@ -661,6 +661,9 @@
|
|||
# communication with the OpenStack service. (string value)
|
||||
#endpoint_type = publicURL
|
||||
|
||||
# Version of Glance API to use in glanceclient. (string value)
|
||||
#api_version = 2
|
||||
|
||||
|
||||
[heat_client]
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# under the License.
|
||||
|
||||
from barbicanclient import client as barbicanclient
|
||||
from glanceclient.v2 import client as glanceclient
|
||||
from glanceclient import client as glanceclient
|
||||
from heatclient import client as heatclient
|
||||
from neutronclient.v2_0 import client as neutronclient
|
||||
from novaclient import client as novaclient
|
||||
|
@ -66,7 +66,10 @@ glance_client_opts = [
|
|||
default='publicURL',
|
||||
help=_(
|
||||
'Type of endpoint in Identity service catalog to use '
|
||||
'for communication with the OpenStack service.'))]
|
||||
'for communication with the OpenStack service.')),
|
||||
cfg.StrOpt('api_version',
|
||||
default='2',
|
||||
help=_('Version of Glance API to use in glanceclient.'))]
|
||||
|
||||
barbican_client_opts = [
|
||||
cfg.StrOpt('region_name',
|
||||
|
@ -183,6 +186,7 @@ class OpenStackClients(object):
|
|||
|
||||
endpoint_type = self._get_client_option('glance', 'endpoint_type')
|
||||
region_name = self._get_client_option('glance', 'region_name')
|
||||
glanceclient_version = self._get_client_option('glance', 'api_version')
|
||||
endpoint = self.url_for(service_type='image',
|
||||
endpoint_type=endpoint_type,
|
||||
region_name=region_name)
|
||||
|
@ -193,7 +197,7 @@ class OpenStackClients(object):
|
|||
'username': None,
|
||||
'password': None,
|
||||
}
|
||||
self._glance = glanceclient.Client(**args)
|
||||
self._glance = glanceclient.Client(glanceclient_version, **args)
|
||||
|
||||
return self._glance
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
# under the License.
|
||||
|
||||
from barbicanclient import client as barbicanclient
|
||||
from glanceclient.v2 import client as glanceclient
|
||||
from glanceclient import client as glanceclient
|
||||
from heatclient import client as heatclient
|
||||
import mock
|
||||
from neutronclient.v2_0 import client as neutronclient
|
||||
|
@ -34,6 +34,8 @@ class ClientsTest(base.BaseTestCase):
|
|||
group='nova_client')
|
||||
cfg.CONF.import_opt('api_version', 'magnum.common.clients',
|
||||
group='heat_client')
|
||||
cfg.CONF.import_opt('api_version', 'magnum.common.clients',
|
||||
group='glance_client')
|
||||
|
||||
@mock.patch.object(clients.OpenStackClients, 'keystone')
|
||||
def test_url_for(self, mock_keystone):
|
||||
|
@ -131,6 +133,7 @@ class ClientsTest(base.BaseTestCase):
|
|||
obj._glance = None
|
||||
obj.glance()
|
||||
mock_call.assert_called_once_with(
|
||||
cfg.CONF.glance_client.api_version,
|
||||
endpoint='url_from_keystone', username=None,
|
||||
token='3bcc3d3a03f44e3d8377f9247b0ad155',
|
||||
auth_url='keystone_url',
|
||||
|
|
Loading…
Reference in New Issue