Skip to content

Commit f2ec22c

Browse files
Minor CLI fixes (#3008)
1. Updated no repo initialized warning message 2. Added logging when config validation errors
1 parent 40d072c commit f2ec22c

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/dstack/_internal/cli/services/configurators/run.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,9 @@ def apply_configuration(
8585
repo_config = config_manager.get_repo_config(repo_path)
8686
if repo_config is None:
8787
warn(
88-
"The repo is not initialized. Starting from 0.19.25, repos are optional\n"
89-
"There are three options:\n"
90-
" - Run `dstack init` to initialize the current directory as a repo\n"
91-
" - Specify `--repo`\n"
92-
" - Specify `--no-repo` to not use any repo and supress this warning"
93-
" (this will be the default in the future versions)"
88+
"Repo is not initialized. "
89+
"Use [code]--repo <dir>[/code] or [code]--no-repo[/code] to initialize it.\n"
90+
"Starting from 0.19.25, repos will be configured via YAML and this message won't appear."
9491
)
9592
if not command_args.yes and not confirm_ask("Continue without the repo?"):
9693
console.print("\nExiting...")

src/dstack/_internal/core/services/configs/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ def load(self):
3838
with open(self.config_filepath, "r") as f:
3939
config = yaml.safe_load(f)
4040
self.config = GlobalConfig.parse_obj(config)
41-
except (FileNotFoundError, ValidationError):
41+
except FileNotFoundError:
42+
self.config = GlobalConfig()
43+
except ValidationError:
44+
logger.error(f"Error in `{self.config_filepath}`", exc_info=True)
4245
self.config = GlobalConfig()
4346

4447
def get_project_config(self, name: Optional[str] = None) -> Optional[ProjectConfig]:

0 commit comments

Comments
 (0)