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

Commit 425811b

Browse files
committed
Reverting changes to the original solution
1 parent 5f5ab3a commit 425811b

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

config/kube_config.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,16 @@ 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-
if get_google_credentials:
126-
self._get_google_credentials = get_google_credentials
127-
else:
125+
def _refresh_credentials():
128126
credentials, project_id = google.auth.default()
129127
request = google.auth.transport.requests.Request()
130128
credentials.refresh(request)
131-
self._get_google_credentials = lambda: (credentials.token)
129+
return credentials.token
130+
131+
if get_google_credentials:
132+
self._get_google_credentials = get_google_credentials
133+
else:
134+
self._get_google_credentials = _refresh_credentials
132135
self._client_configuration = client_configuration
133136

134137
def set_active_context(self, context_name=None):

0 commit comments

Comments
 (0)