Fix endpoint usage for glance_http in image client.
Previously the image client was using python-keystoneclient to
generate a new token and to get the endpoint for glance to use
with the glance http library. This was causing permission issues
if the rest client was used to try and delete an image created using
glance_http.
This commit corrects the behavior so that the token and endpoint are
acquired the same way as the rest client so there is no potential
permission issues between the http libraries.
Change-Id: Idff5fcb82019c6b807b87dda480fbcf0b6f8aef2
diff --git a/tempest/services/image/json/image_client.py b/tempest/services/image/json/image_client.py
index f119664..277075e 100644
--- a/tempest/services/image/json/image_client.py
+++ b/tempest/services/image/json/image_client.py
@@ -25,7 +25,6 @@
from tempest.common import glance_http
from tempest.common.rest_client import RestClient
from tempest import exceptions
-from tempest import manager
class ImageClientJSON(RestClient):
@@ -97,11 +96,11 @@
return None
def _get_http(self):
- temp_manager = manager.DefaultClientManager()
- keystone = temp_manager._get_identity_client()
- token = keystone.auth_token
- endpoint = keystone.service_catalog.url_for(service_type='image',
- endpoint_type='publicURL')
+ token, endpoint = self.keystone_auth(self.user,
+ self.password,
+ self.auth_url,
+ self.service,
+ self.tenant_name)
dscv = self.config.identity.disable_ssl_certificate_validation
return glance_http.HTTPClient(endpoint=endpoint, token=token,
insecure=dscv)
@@ -170,11 +169,7 @@
def delete_image(self, image_id):
url = 'v1/images/%s' % image_id
- try:
- self.delete(url)
- except exceptions.Unauthorized:
- url = '/' + url
- self.http.raw_request('DELETE', url)
+ self.delete(url)
def image_list(self, **kwargs):
url = 'v1/images'