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

Commit

Permalink
Merge pull request #158 from qlemaire22/master
Browse files Browse the repository at this point in the history
Check is not None in safe_get
  • Loading branch information
k8s-ci-robot committed Sep 20, 2019
2 parents 5092d96 + a29bf29 commit af42f24
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion config/kube_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,11 @@ def __init__(self, config_dict, active_context=None,
config_base_path="",
config_persister=None):

if isinstance(config_dict, ConfigNode):
if config_dict is None:
raise ConfigException(
'Invalid kube-config. '
'Expected config_dict to not be None.')
elif isinstance(config_dict, ConfigNode):
self._config = config_dict
else:
self._config = ConfigNode('kube-config', config_dict)
Expand Down Expand Up @@ -613,6 +617,11 @@ def _get_kube_config_loader_for_yaml_file(
if persist_config and 'config_persister' not in kwargs:
kwargs['config_persister'] = kcfg.save_changes()

if kcfg.config is None:
raise ConfigException(
'Invalid kube-config file. '
'No configuration found.')

return KubeConfigLoader(
config_dict=kcfg.config,
config_base_path=None,
Expand Down

0 comments on commit af42f24

Please sign in to comment.