Skip to content
This repository was archived by the owner on Mar 13, 2022. It is now read-only.

Commit 5f5ab3a

Browse files
committed
Another solution, trying to fix Google default credentials without breaking tests
1 parent d1b1ea9 commit 5f5ab3a

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

config/kube_config.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -122,16 +122,13 @@ def __init__(self, config_dict, active_context=None,
122122
self.set_active_context(active_context)
123123
self._config_base_path = config_base_path
124124

125-
def _refresh_credentials():
126-
credentials, project_id = google.auth.default()
127-
request = google.auth.transport.requests.Request()
128-
credentials.refresh(request)
129-
return credentials.token
130-
131125
if get_google_credentials:
132126
self._get_google_credentials = get_google_credentials
133127
else:
134-
self._get_google_credentials = _refresh_credentials
128+
credentials, project_id = google.auth.default()
129+
request = google.auth.transport.requests.Request()
130+
credentials.refresh(request)
131+
self._get_google_credentials = lambda: (credentials.token)
135132
self._client_configuration = client_configuration
136133

137134
def set_active_context(self, context_name=None):

0 commit comments

Comments
 (0)