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

Commit

Permalink
config: Fix persist_config flag and function calls
Browse files Browse the repository at this point in the history
The persist_config flag was setting the kwargs['config_persister'] to
the result of the function kcfg.save_changes and not the function
kcfg.save_changes itself.

Once this is fixed, the second problem was that the function was called
with an argument when it's defined without argument so an exception was
raised.
  • Loading branch information
jfrabaute committed Oct 4, 2019
1 parent afd1301 commit 8645637
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions config/kube_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ def _refresh_azure_token(self, config):
provider.value['access-token'] = token_response['accessToken']
provider.value['expires-on'] = token_response['expiresOn']
if self._config_persister:
self._config_persister(self._config.value)
self._config_persister()

def _load_gcp_token(self, provider):
if (('config' not in provider) or
Expand All @@ -281,7 +281,7 @@ def _refresh_gcp_token(self):
provider.value['access-token'] = credentials.token
provider.value['expiry'] = format_rfc3339(credentials.expiry)
if self._config_persister:
self._config_persister(self._config.value)
self._config_persister()

def _load_oid_token(self, provider):
if 'config' not in provider:
Expand Down Expand Up @@ -322,7 +322,7 @@ def _load_oid_token(self, provider):
self._refresh_oidc(provider)

if self._config_persister:
self._config_persister(self._config.value)
self._config_persister()

self.token = "Bearer %s" % provider['config']['id-token']

Expand Down Expand Up @@ -615,7 +615,7 @@ def _get_kube_config_loader_for_yaml_file(

kcfg = KubeConfigMerger(filename)
if persist_config and 'config_persister' not in kwargs:
kwargs['config_persister'] = kcfg.save_changes()
kwargs['config_persister'] = kcfg.save_changes

if kcfg.config is None:
raise ConfigException(
Expand Down

0 comments on commit 8645637

Please sign in to comment.