|
1 | 1 | from abc import ABCMeta, abstractmethod |
2 | 2 | from dataclasses import dataclass |
3 | | -from typing import Any, List |
| 3 | +from typing import Any, List, Optional |
4 | 4 |
|
5 | 5 |
|
6 | 6 | # types to represent log levels |
@@ -304,6 +304,36 @@ def cli_msg(self) -> str: |
304 | 304 | return self.msg |
305 | 305 |
|
306 | 306 |
|
| 307 | +@dataclass |
| 308 | +class MissingProfileTarget(InfoLevel, CliEventABC): |
| 309 | + profile_name: str |
| 310 | + target_name: str |
| 311 | + |
| 312 | + def cli_msg(self) -> str: |
| 313 | + return f"target not specified in profile '{self.profile_name}', using '{self.target_name}'" |
| 314 | + |
| 315 | + |
| 316 | +@dataclass |
| 317 | +class ProfileLoadError(ShowException, DebugLevel, CliEventABC): |
| 318 | + exc: Exception |
| 319 | + |
| 320 | + def cli_msg(self) -> str: |
| 321 | + return f"Profile not loaded due to error: {self.exc}" |
| 322 | + |
| 323 | + |
| 324 | +@dataclass |
| 325 | +class ProfileNotFound(InfoLevel, CliEventABC): |
| 326 | + profile_name: Optional[str] |
| 327 | + |
| 328 | + def cli_msg(self) -> str: |
| 329 | + return f'No profile "{self.profile_name}" found, continuing with no target' |
| 330 | + |
| 331 | + |
| 332 | +class InvalidVarsYAML(ErrorLevel, CliEventABC): |
| 333 | + def cli_msg(self) -> str: |
| 334 | + return "The YAML provided in the --vars argument is not valid.\n" |
| 335 | + |
| 336 | + |
307 | 337 | @dataclass |
308 | 338 | class NewConnectionOpening(DebugLevel, CliEventABC): |
309 | 339 | connection_state: str |
@@ -364,3 +394,7 @@ def cli_msg(self) -> str: |
364 | 394 | NewConnectionOpening(connection_state='') |
365 | 395 | TimingInfoCollected() |
366 | 396 | MergedFromState(nbr_merged=0, sample=[]) |
| 397 | + MissingProfileTarget(profile_name='', target_name='') |
| 398 | + ProfileLoadError(exc=Exception('')) |
| 399 | + ProfileNotFound(profile_name='') |
| 400 | + InvalidVarsYAML() |
0 commit comments