From c28ce3b79897a4edf36f383d89679bfbebbbf0df Mon Sep 17 00:00:00 2001 From: Brian Waldon Date: Tue, 31 Jul 2012 13:28:48 -0700 Subject: [PATCH] Update glanceclient imports and version req * Update references to glanceclient.v1.client.Client to glanceclient.Client * Update references to glanceclient.common.exceptions to glanceclient.exc * Update version requirement of python-glanceclient to v0.2.X Change-Id: I9478f16dd7d31edebaa88de244b542eb05cb24fa --- horizon/api/glance.py | 4 ++-- horizon/api/nova.py | 2 +- horizon/test.py | 6 +++--- horizon/tests/test_data/exceptions.py | 2 +- tools/pip-requires | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/horizon/api/glance.py b/horizon/api/glance.py index 1b3a02bcd..e0563a08b 100644 --- a/horizon/api/glance.py +++ b/horizon/api/glance.py @@ -26,7 +26,7 @@ import urlparse from django.conf import settings -from glanceclient.v1 import client as glance_client +import glanceclient as glance_client from horizon.api.base import url_for @@ -40,7 +40,7 @@ def glanceclient(request): insecure = getattr(settings, 'OPENSTACK_SSL_NO_VERIFY', False) LOG.debug('glanceclient connection created using token "%s" and url "%s"' % (request.user.token.id, url)) - return glance_client.Client(endpoint=url, token=request.user.token.id, + return glance_client.Client('1', url, token=request.user.token.id, insecure=insecure) diff --git a/horizon/api/nova.py b/horizon/api/nova.py index 4e40832ac..e4315a641 100644 --- a/horizon/api/nova.py +++ b/horizon/api/nova.py @@ -96,7 +96,7 @@ class Server(APIResourceWrapper): @property def image_name(self): - from glanceclient.common import exceptions as glance_exceptions + import glanceclient.exc as glance_exceptions from horizon.api import glance try: image = glance.image_get(self.request, self.image['id']) diff --git a/horizon/test.py b/horizon/test.py index 4d70a4976..f5ce99581 100644 --- a/horizon/test.py +++ b/horizon/test.py @@ -32,7 +32,7 @@ from django.core.handlers import wsgi from django.test.client import RequestFactory from django.utils import unittest -from glanceclient.v1 import client as glance_client +import glanceclient from keystoneclient.v2_0 import client as keystone_client from novaclient.v1_1 import client as nova_client from selenium.webdriver.firefox.webdriver import WebDriver @@ -316,8 +316,8 @@ class APITestCase(TestCase): def stub_glanceclient(self): if not hasattr(self, "glanceclient"): - self.mox.StubOutWithMock(glance_client, 'Client') - self.glanceclient = self.mox.CreateMock(glance_client.Client) + self.mox.StubOutWithMock(glanceclient, 'Client') + self.glanceclient = self.mox.CreateMock(glanceclient.Client) return self.glanceclient def stub_swiftclient(self, expected_calls=1): diff --git a/horizon/tests/test_data/exceptions.py b/horizon/tests/test_data/exceptions.py index 248bb024d..a5a856dec 100644 --- a/horizon/tests/test_data/exceptions.py +++ b/horizon/tests/test_data/exceptions.py @@ -12,7 +12,7 @@ # License for the specific language governing permissions and limitations # under the License. -from glanceclient.common import exceptions as glance_exceptions +import glanceclient.exc as glance_exceptions from keystoneclient import exceptions as keystone_exceptions from novaclient import exceptions as nova_exceptions diff --git a/tools/pip-requires b/tools/pip-requires index 695efc3c7..1c8d452bf 100644 --- a/tools/pip-requires +++ b/tools/pip-requires @@ -3,7 +3,7 @@ Django>=1.4 django_compressor django_openstack_auth python-cloudfiles -python-glanceclient +python-glanceclient>=0.2,<0.3 python-keystoneclient python-novaclient pytz