Fixed issue when savanna url is not provided

* Now savannaclient takes savanna_url is as follows:
  https://HOST:PORT/VERSION/PROJECT_ID
  IMPORTANT! This URL pattern and only this is valid for client now.

* Old URL pattern 'https://HOST:PORT/VERSION' is no longer valid and
  exception will be rised on attempt to connect to 'data_processing'
  service

* Why this needed, because it's common OS approach:
  - base.url_for(ctx.service_catalog, 'data_processing') returns
    https://HOST:PORT/VERSION/PROJECT_ID
  - This bug blocks impl of bp savanna-as-heat-resource
  - Here we recieve https://HOST:PORT/VERSION/PROJECT_ID
    https://github.com/openstack/python-savannaclient/blob/master/savannaclient/api/client.py#L60

Change-Id: Iba98d2a57c0aa7900e3b4ec8bbc69b198e933db4
Closes-Bug: #1274913
This commit is contained in:
Alexander Ignatov
2014-01-31 16:45:52 +04:00
parent 05316d56cb
commit f2129eaeec

View File

@@ -62,20 +62,8 @@ class Client(object):
if not savanna_catalog_url:
raise RuntimeError("Could not find Savanna endpoint in catalog")
if not project_id:
keystone = self.get_keystone_client(username=username,
api_key=api_key,
auth_url=auth_url,
token=input_auth_token,
project_name=project_name)
project_id = self.get_projects_list(keystone).find(
name=project_name).id
if not project_id:
raise RuntimeError("Could not determine tenant id")
savanna_url = savanna_catalog_url + "/" + project_id
self.client = httpclient.HTTPClient(savanna_url, input_auth_token)
self.client = httpclient.HTTPClient(savanna_catalog_url,
input_auth_token)
self.clusters = clusters.ClusterManager(self)
self.cluster_templates = cluster_templates.ClusterTemplateManager(self)