Skip to content

Commit

Permalink
Fixes lp#948685 proxy_token and proxy_tenant_id behavior
Browse files Browse the repository at this point in the history
* renamed token to proxy_token because of its usage
* added a proxy_tenant_id for new keystone tokens/id/?belongsTo

Change-Id: Ic7e65612620e5a54f04eddb79bffed7e2df6fba2
  • Loading branch information
hub-cap committed Mar 8, 2012
1 parent 0528368 commit 4ff001d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Expand Up @@ -36,6 +36,7 @@ Kirill Shileev <kshileev@griddynamics.com>
Lvov Maxim <mlvov@mirantis.com>
Matt Dietz <matt.dietz@rackspace.com>
Matt Stephenson <mattstep@mattstep.net>
Michael Basnight <mbasnight@gmail.com>
Nicholas Mistry <nmistry@gmail.com>
Nikolay Sokolov <nsokolov@griddynamics.com>
Pavel Shkitin <pshkitin@griddynamics.com>
Expand Down
9 changes: 6 additions & 3 deletions novaclient/client.py
Expand Up @@ -35,7 +35,8 @@ class HTTPClient(httplib2.Http):
USER_AGENT = 'python-novaclient'

def __init__(self, user, password, projectid, auth_url, insecure=False,
timeout=None, token=None, region_name=None,
timeout=None, proxy_tenant_id=None,
proxy_token=None, region_name=None,
endpoint_type='publicURL', service_type=None,
service_name=None):
super(HTTPClient, self).__init__(timeout=timeout)
Expand All @@ -51,7 +52,8 @@ def __init__(self, user, password, projectid, auth_url, insecure=False,

self.management_url = None
self.auth_token = None
self.proxy_token = token
self.proxy_token = proxy_token
self.proxy_tenant_id = proxy_tenant_id

# httplib2 overrides
self.force_exception_to_status_code = True
Expand Down Expand Up @@ -192,7 +194,8 @@ def _fetch_endpoints_from_auth(self, url):
"""

# GET ...:5001/v2.0/tokens/#####/endpoints
url = '/'.join([url, 'tokens', self.proxy_token, 'endpoints'])
url = '/'.join([url, 'tokens', '%s?belongsTo=%s'
% (self.proxy_token, self.proxy_tenant_id)])
_logger.debug("Using Endpoint URL: %s" % url)
resp, body = self.request(url, "GET",
headers={'X-Auth_Token': self.auth_token})
Expand Down
6 changes: 4 additions & 2 deletions novaclient/v1_1/client.py
Expand Up @@ -39,7 +39,8 @@ class Client(object):

# FIXME(jesse): project_id isn't required to authenticate
def __init__(self, username, api_key, project_id, auth_url,
insecure=False, timeout=None, token=None, region_name=None,
insecure=False, timeout=None, proxy_tenant_id=None,
proxy_token=None, region_name=None,
endpoint_type='publicURL', extensions=None,
service_type=None, service_name=None):
# FIXME(comstud): Rename the api_key argument above when we
Expand Down Expand Up @@ -83,7 +84,8 @@ def __init__(self, username, api_key, project_id, auth_url,
auth_url,
insecure=insecure,
timeout=timeout,
token=token,
proxy_token=proxy_token,
proxy_tenant_id=proxy_tenant_id,
region_name=region_name,
endpoint_type=endpoint_type,
service_type=service_type,
Expand Down

0 comments on commit 4ff001d

Please sign in to comment.