Skip to content

Commit 2202d85

Browse files
Guillaume De Saint MartinGuillaumeDSM
authored andcommitted
[Cli] display message on missing profiles
1 parent 2c9b373 commit 2202d85

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

octobot/cli.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ def _create_startup_config(logger):
120120
config.read(should_raise=False)
121121
else:
122122
_read_config(config, logger)
123+
_ensure_profile(config, logger)
123124
_validate_config(config, logger)
124125
return config
125126

@@ -135,6 +136,19 @@ def _read_config(config, logger):
135136
raise errors.ConfigError(e)
136137

137138

139+
def _ensure_profile(config, logger):
140+
if config.profile is None:
141+
# no selected profile or profile not found
142+
try:
143+
config.select_profile(common_constants.DEFAULT_PROFILE)
144+
except KeyError:
145+
logger.error(f"Missing default profiles. Please make sure that the {config.profiles_path} "
146+
f"folder is accessible. To reinstall default profiles, delete the "
147+
f"'{tentacles_manager_constants.TENTACLES_PATH}' "
148+
f"folder or start OctoBot with the following arguments: tentacles --install --all")
149+
raise errors.NoProfileError
150+
151+
138152
def _validate_config(config, logger):
139153
try:
140154
config.validate()

0 commit comments

Comments
 (0)