updates
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/3262d355 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/3262d355 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/3262d355 Branch: refs/heads/trunk Commit: 3262d35516f65b3017ceb4b1e5304b5009f17f56 Parents: 4cefbba Author: andy <[email protected]> Authored: Sun Jun 18 19:15:07 2017 -0400 Committer: andy <[email protected]> Committed: Sun Jun 18 19:15:07 2017 -0400 ---------------------------------------------------------------------- libcloud/container/drivers/gke.py | 22 +++++++++++----------- libcloud/test/container/test_gke.py | 4 ++-- 2 files changed, 13 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/3262d355/libcloud/container/drivers/gke.py ---------------------------------------------------------------------- diff --git a/libcloud/container/drivers/gke.py b/libcloud/container/drivers/gke.py index acac294..519c893 100644 --- a/libcloud/container/drivers/gke.py +++ b/libcloud/container/drivers/gke.py @@ -42,24 +42,24 @@ class GKEConnection(GoogleBaseConnection): super(GKEConnection, self).__init__( user_id, key, secure=secure, auth_type=auth_type, credential_file=credential_file, **kwargs) - self.request_path = '%s/projects/%s' % (API_VERSION, project) - self.gce_params = None + self.request_path = '/%s/projects/%s' % (API_VERSION, project) + self.gke_params = None def pre_connect_hook(self, params, headers): """ - Update URL parameters with values from self.gce_params. + Update URL parameters with values from self.gke_params. @inherits: :class:`GoogleBaseConnection.pre_connect_hook` """ params, headers = super(GKEConnection, self).pre_connect_hook(params, headers) - if self.gce_params: + if self.gke_params: params.update(self.gce_params) return params, headers def request(self, *args, **kwargs): """ - Perform request then do GCE-specific processing of URL params. + Perform request then do GKE-specific processing of URL params. @inherits: :class:`GoogleBaseConnection.request` """ @@ -67,12 +67,12 @@ class GKEConnection(GoogleBaseConnection): # If gce_params has been set, then update the pageToken with the # nextPageToken so it can be used in the next request. - if self.gce_params: + if self.gke_params: if 'nextPageToken' in response.object: - self.gce_params['pageToken'] = response.object['nextPageToken'] - elif 'pageToken' in self.gce_params: - del self.gce_params['pageToken'] - self.gce_params = None + self.gke_params['pageToken'] = response.object['nextPageToken'] + elif 'pageToken' in self.gke_params: + del self.gke_params['pageToken'] + self.gke_params = None return response @@ -179,7 +179,7 @@ class GKEContainerDriver(KubernetesContainerDriver): """ if zone is None: zone = self.zone - request = "/zones/%s/serverconfig" % (self.zone) + request = "/zones/%s/serverconfig" % (zone) response = self.connection.request(request, method='GET').object return response http://git-wip-us.apache.org/repos/asf/libcloud/blob/3262d355/libcloud/test/container/test_gke.py ---------------------------------------------------------------------- diff --git a/libcloud/test/container/test_gke.py b/libcloud/test/container/test_gke.py index 0129f9c..5d0f41e 100644 --- a/libcloud/test/container/test_gke.py +++ b/libcloud/test/container/test_gke.py @@ -19,7 +19,7 @@ Tests for Google Container Engine Driver import sys import unittest -# from libcloud.utils.py3 import httplib +from libcloud.utils.py3 import httplib from libcloud.container.drivers.gke import GKEContainerDriver, API_VERSION from libcloud.common.google import (GoogleBaseAuthConnection) from libcloud.test.common.test_google import GoogleAuthMockHttp, GoogleTestCase @@ -62,7 +62,7 @@ class GKEMockHttp(MockHttp): json_hdr = {'content-type': 'application/json; charset=UTF-8'} def _get_method_name(self, type, use_param, qs, path): - api_path = '%s' % API_VERSION + api_path = '/%s' % API_VERSION project_path = '/projects/%s' % GKE_KEYWORD_PARAMS['project'] path = path.replace(api_path, '') # This replace is separate, since there is a call with a different
