Skip to content
This repository has been archived by the owner on Feb 21, 2022. It is now read-only.

Commit

Permalink
Fix black
Browse files Browse the repository at this point in the history
  • Loading branch information
bayotop committed Jul 29, 2019
1 parent 939c9e1 commit 236e542
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
9 changes: 4 additions & 5 deletions test/datacenters/test_gcp.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

from unittest.mock import MagicMock
import pytest

Expand Down Expand Up @@ -34,7 +33,9 @@ def test_gcp_map_to_nodes(mocker):
"zoo.datacenters.utils.GCPClient.get_all_clusters",
return_value=[{"name": "test", "zone": "europe-test"}],
)
mocker.patch("zoo.datacenters.utils.kube.KubernetesClient.__init__", return_value=None)
mocker.patch(
"zoo.datacenters.utils.kube.KubernetesClient.__init__", return_value=None
)

workload = MagicMock()
image1 = MagicMock()
Expand All @@ -48,9 +49,7 @@ def test_gcp_map_to_nodes(mocker):

mocker.patch(
"zoo.datacenters.utils.kube.KubernetesClient.iter_workloads",
return_value={
"test-type": [workload]
},
return_value={"test-type": [workload]},
)

uut.map_to_nodes()
Expand Down
2 changes: 1 addition & 1 deletion zoo/datacenters/gcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,4 @@ def map_to_nodes():
kind=NodeKind.DOCKER_IMAGE_UUID,
value=container.image,
source=workload_node,
)
)
12 changes: 9 additions & 3 deletions zoo/datacenters/utils/gcloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,12 @@ def __init__(self):
self.projectService = discovery.build(
"cloudresourcemanager", "v1", credentials=self.credentials
)
self.computeService = discovery.build("compute", "v1", credentials=self.credentials)
self.containerService = discovery.build("container", "v1", credentials=self.credentials)
self.computeService = discovery.build(
"compute", "v1", credentials=self.credentials
)
self.containerService = discovery.build(
"container", "v1", credentials=self.credentials
)

def get_all_projects(self):
request = self.projectService.projects().list()
Expand Down Expand Up @@ -72,7 +76,9 @@ def get_project_owners(self, project_id):
for binding in bindings:
if binding["role"] == "roles/owner":
return [
member for member in binding["members"] if member.endswith("@kiwi.com")
member
for member in binding["members"]
if member.endswith("@kiwi.com")
]

def get_clusters_by_name(self, cluster):
Expand Down
4 changes: 3 additions & 1 deletion zoo/datacenters/utils/kube.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ def __init__(self, cluster):
config.host = f"https://{cluster['endpoint']}"

config.api_key_prefix["authorization"] = "Bearer"
config.api_key["authorization"] = _token(gcloud._get_credentials(), "cloud-platform")
config.api_key["authorization"] = _token(
gcloud._get_credentials(), "cloud-platform"
)

with NamedTemporaryFile(delete=False) as cert:
cert.write(
Expand Down

0 comments on commit 236e542

Please sign in to comment.