do expanduser in load_config

This commit is contained in:
David Otto 2021-07-12 11:21:13 +02:00
parent dca0ca6df2
commit e2ba3fb9fc
2 changed files with 3 additions and 4 deletions

View File

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import os
from os.path import exists, expanduser
from .config_exception import ConfigException
from .incluster_config import load_incluster_config
@ -33,8 +33,7 @@ def load_config(**kwargs):
can be passed to either load_kube_config or
load_incluster_config functions.
"""
if "kube_config_path" in kwargs.keys() or os.path.exists(
KUBE_CONFIG_DEFAULT_LOCATION):
if "kube_config_path" in kwargs.keys() or exists(expanduser(KUBE_CONFIG_DEFAULT_LOCATION)):
load_kube_config(**kwargs)
else:
print(

View File

@ -45,7 +45,7 @@ except ImportError:
pass
EXPIRY_SKEW_PREVENTION_DELAY = datetime.timedelta(minutes=5)
KUBE_CONFIG_DEFAULT_LOCATION = os.path.expanduser(os.environ.get('KUBECONFIG', '~/.kube/config'))
KUBE_CONFIG_DEFAULT_LOCATION = os.environ.get('KUBECONFIG', '~/.kube/config')
ENV_KUBECONFIG_PATH_SEPARATOR = ';' if platform.system() == 'Windows' else ':'
_temp_files = {}