Only initialize the glance_http if service is enabled

This commit just adds a check to see if glance is set as enabled in
the config file before initializing the glance http client. Previously
regardless of whether glance was enabled or not glance_http would
auth against keystone.

Closes-Bug: #1214774
Change-Id: I07127c21d55d58fdb294468a0b74ce2bc54d8719
This commit is contained in:
Matthew Treinish
2013-12-12 16:42:31 +00:00
parent 48fbbdc8ee
commit 406da27a77
2 changed files with 4 additions and 2 deletions

View File

@@ -36,7 +36,8 @@ class ImageClientJSON(RestClient):
super(ImageClientJSON, self).__init__(config, username, password,
auth_url, tenant_name)
self.service = self.config.images.catalog_type
self.http = self._get_http()
if config.service_available.glance:
self.http = self._get_http()
def _image_meta_from_headers(self, headers):
meta = {'properties': {}}

View File

@@ -31,7 +31,8 @@ class ImageClientV2JSON(rest_client.RestClient):
super(ImageClientV2JSON, self).__init__(config, username, password,
auth_url, tenant_name)
self.service = self.config.images.catalog_type
self.http = self._get_http()
if config.service_available.glance:
self.http = self._get_http()
def _get_http(self):
token, endpoint = self.keystone_auth(self.user, self.password,