Skip to content

Commit

Permalink
[Core] Error out for a non-exist SKYPILOT_CONFIG (#3423)
Browse files Browse the repository at this point in the history
* Error out for a non-exist CONFIG_PATH

* expanduser for the config yaml
  • Loading branch information
Michaelvll authored Apr 5, 2024
1 parent d18b70a commit 7672360
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion sky/skypilot_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
from sky import sky_logging
from sky.utils import common_utils
from sky.utils import schemas
from sky.utils import ux_utils

# The config path is discovered in this order:
#
Expand Down Expand Up @@ -128,7 +129,14 @@ def _try_load_config() -> None:
global _dict, _loaded_config_path
config_path_via_env_var = os.environ.get(ENV_VAR_SKYPILOT_CONFIG)
if config_path_via_env_var is not None:
config_path = config_path_via_env_var
config_path = os.path.expanduser(config_path_via_env_var)
if not os.path.exists(config_path):
with ux_utils.print_exception_no_traceback():
raise FileNotFoundError(
'Config file specified by env var '
f'{ENV_VAR_SKYPILOT_CONFIG} ({config_path!r}) does not '
'exist. Please double check the path or unset the env var: '
f'unset {ENV_VAR_SKYPILOT_CONFIG}')
else:
config_path = CONFIG_PATH
config_path = os.path.expanduser(config_path)
Expand Down

0 comments on commit 7672360

Please sign in to comment.