fixing typos
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/6f3e4c6d Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/6f3e4c6d Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/6f3e4c6d Branch: refs/heads/trunk Commit: 6f3e4c6d622ea0622f3ba0676e704337d00c456e Parents: f049cce Author: andy <[email protected]> Authored: Sun Jun 18 20:39:30 2017 -0400 Committer: andy <[email protected]> Committed: Sun Jun 18 20:39:30 2017 -0400 ---------------------------------------------------------------------- docs/container/drivers/gke.rst | 2 +- libcloud/compute/drivers/gce.py | 3 ++- libcloud/container/drivers/gke.py | 18 +++++++++++++----- libcloud/container/drivers/kubernetes.py | 1 - libcloud/test/container/test_gke.py | 14 +++++++++++--- 5 files changed, 27 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/6f3e4c6d/docs/container/drivers/gke.rst ---------------------------------------------------------------------- diff --git a/docs/container/drivers/gke.rst b/docs/container/drivers/gke.rst index 930c8c6..3edc473 100644 --- a/docs/container/drivers/gke.rst +++ b/docs/container/drivers/gke.rst @@ -21,7 +21,7 @@ https://github.com/apache/libcloud/blob/trunk/demos/gce_demo.py API Docs -------- -.. autoclass:: libcloud.container.drivers.joyent.GKEContainerDriver +.. autoclass:: libcloud.container.drivers.gke.GKEContainerDriver :members: :inherited-members: http://git-wip-us.apache.org/repos/asf/libcloud/blob/6f3e4c6d/libcloud/compute/drivers/gce.py ---------------------------------------------------------------------- diff --git a/libcloud/compute/drivers/gce.py b/libcloud/compute/drivers/gce.py index 41eef06..d5e837b 100644 --- a/libcloud/compute/drivers/gce.py +++ b/libcloud/compute/drivers/gce.py @@ -69,7 +69,7 @@ class GCEConnection(GoogleBaseConnection): """ Connection class for the GCE driver. - GCEConnection extends :class:`google.GoogleBaseConnection` for 2 reasons: + GCEConnection extends :class:`google.GoogleBaseConnection` for 3 reasons: 1. modify request_path for GCE URI. 2. Implement gce_params functionality described below. 3. Add request_aggregated_items method for making aggregated API calls. @@ -2750,6 +2750,7 @@ class GCENodeDriver(NodeDriver): :return: A list of zone objects. :rtype: ``list`` of :class:`GCEZone` """ + print("WHEN DO WE DO THIS") list_zones = [] request = '/zones' response = self.connection.request(request, method='GET').object http://git-wip-us.apache.org/repos/asf/libcloud/blob/6f3e4c6d/libcloud/container/drivers/gke.py ---------------------------------------------------------------------- diff --git a/libcloud/container/drivers/gke.py b/libcloud/container/drivers/gke.py index 646838f..f95ddf7 100644 --- a/libcloud/container/drivers/gke.py +++ b/libcloud/container/drivers/gke.py @@ -14,7 +14,7 @@ class GKEConnection(GoogleBaseConnection): """ Connection class for the GKE driver. - GKEConnection extends :class:`google.GoogleBaseConnection` for 2 reasons: + GKEConnection extends :class:`google.GoogleBaseConnection` for 3 reasons: 1. modify request_path for GKE URI. 2. Implement gce_params functionality described below. 3. Add request_aggregated_items method for making aggregated API calls. @@ -84,8 +84,6 @@ class GKEContainerDriver(KubernetesContainerDriver): AUTH_URL = "https://container.googleapis.com/auth/" - BACKEND_SERVICE_PROTOCOLS = ['HTTP', 'HTTPS', 'HTTP2', 'TCP', 'SSL'] - def __init__(self, user_id, key=None, datacenter=None, project=None, auth_type=None, scopes=None, credential_file=None, host=None, port=443, **kwargs): @@ -150,8 +148,13 @@ class GKEContainerDriver(KubernetesContainerDriver): 'scopes': self.scopes, 'credential_file': self.credential_file} - def list_images(self, zone=None): + def list_clusters(self, ex_zone=None): """ + Return a list of cluster information in the current zone or all zones. + + :keyword ex_zone: Optional zone name or None + :type ex_zone: ``str`` or :class:`GCEZone` or + :class:`NodeLocation` or ``None`` """ request = "/zones/%s/clusters" % (zone) if zone is None: @@ -160,8 +163,13 @@ class GKEContainerDriver(KubernetesContainerDriver): response = self.connection.request(request, method='GET').object return response - def get_server_config(self, zone=None): + def get_server_config(self, ex_zone=None): """ + Return configuration info about the Container Engine service. + + :keyword ex_zone: Optional zone name or None + :type ex_zone: ``str`` or :class:`GCEZone` or + :class:`NodeLocation` or ``None`` """ if zone is None: zone = self.zone http://git-wip-us.apache.org/repos/asf/libcloud/blob/6f3e4c6d/libcloud/container/drivers/kubernetes.py ---------------------------------------------------------------------- diff --git a/libcloud/container/drivers/kubernetes.py b/libcloud/container/drivers/kubernetes.py index f3c547a..4c7dcba 100644 --- a/libcloud/container/drivers/kubernetes.py +++ b/libcloud/container/drivers/kubernetes.py @@ -123,7 +123,6 @@ class KubernetesContainerDriver(ContainerDriver): :return: ``None`` """ - print(key, secret) super(KubernetesContainerDriver, self).__init__(key=key, secret=secret, secure=secure, host=host, http://git-wip-us.apache.org/repos/asf/libcloud/blob/6f3e4c6d/libcloud/test/container/test_gke.py ---------------------------------------------------------------------- diff --git a/libcloud/test/container/test_gke.py b/libcloud/test/container/test_gke.py index 5d0f41e..909747b 100644 --- a/libcloud/test/container/test_gke.py +++ b/libcloud/test/container/test_gke.py @@ -50,11 +50,13 @@ class GKEContainerDriverTestCase(GoogleTestCase, TestCaseMixin): self.driver = GKEContainerDriver(*GKE_PARAMS, **kwargs) def test_list_images_response(self): - pass + config = self.driver.list_clusters(ex_zone="us-central1-a") + assert "zone" in config + assert config.zone = "us-central1-a" def test_server_config(self): - zones = self.driver.get_server_config() - print(zones) + config = self.driver.get_server_config() + assert "validImageTypes" in config class GKEMockHttp(MockHttp): @@ -82,5 +84,11 @@ class GKEMockHttp(MockHttp): 'zones_us-central1-a_instance_serverconfig.json') return (httplib.OK, body, self.json_hdr, httplib.responses[httplib.OK]) + def _zones_us_central1_a_clusters(self, method, url, body, headers): + body = self.fixtures.load( + 'zones_us-central1-a_list.json') + return (httplib.OK, body, self.json_hdr, httplib.responses[httplib.OK]) + + if __name__ == '__main__': sys.exit(unittest.main())
