Skip to content

Commit e2ba3fb

Browse files
committed
do expanduser in load_config
1 parent dca0ca6 commit e2ba3fb

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

config/__init__.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
import os
15+
from os.path import exists, expanduser
1616

1717
from .config_exception import ConfigException
1818
from .incluster_config import load_incluster_config
@@ -33,8 +33,7 @@ def load_config(**kwargs):
3333
can be passed to either load_kube_config or
3434
load_incluster_config functions.
3535
"""
36-
if "kube_config_path" in kwargs.keys() or os.path.exists(
37-
KUBE_CONFIG_DEFAULT_LOCATION):
36+
if "kube_config_path" in kwargs.keys() or exists(expanduser(KUBE_CONFIG_DEFAULT_LOCATION)):
3837
load_kube_config(**kwargs)
3938
else:
4039
print(

config/kube_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
pass
4646

4747
EXPIRY_SKEW_PREVENTION_DELAY = datetime.timedelta(minutes=5)
48-
KUBE_CONFIG_DEFAULT_LOCATION = os.path.expanduser(os.environ.get('KUBECONFIG', '~/.kube/config'))
48+
KUBE_CONFIG_DEFAULT_LOCATION = os.environ.get('KUBECONFIG', '~/.kube/config')
4949
ENV_KUBECONFIG_PATH_SEPARATOR = ';' if platform.system() == 'Windows' else ':'
5050
_temp_files = {}
5151

0 commit comments

Comments
 (0)