From 87434506f9c2fcf0366755135a01aec8d2e42be1 Mon Sep 17 00:00:00 2001 From: Jennings Zhang Date: Fri, 15 Jul 2022 00:36:30 -0400 Subject: [PATCH] Catch ValidationError during full expand --- chrisomatic/cli/agenda.py | 20 ++++++++++++-------- chrisomatic/spec/given.py | 2 +- pyproject.toml | 2 +- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/chrisomatic/cli/agenda.py b/chrisomatic/cli/agenda.py index c124dc3..59f40ce 100644 --- a/chrisomatic/cli/agenda.py +++ b/chrisomatic/cli/agenda.py @@ -14,7 +14,7 @@ from chrisomatic.core.omniclient import A from chrisomatic.framework.outcome import Outcome from chrisomatic.spec.common import User -from chrisomatic.spec.given import GivenConfig +from chrisomatic.spec.given import GivenConfig, ValidationError async def agenda(given_config: GivenConfig, console: Console) -> FinalResult: @@ -83,17 +83,21 @@ async def agenda(given_config: GivenConfig, console: Console) -> FinalResult: given_config.cube.users, cube_user_creation ) - # ------------------------------------------------------------ - # Fully expand config - # ------------------------------------------------------------ - config = await smart_expand_config( - given_config, actions.omniclient.docker, _get_first_username(store_clients) - ) - # ------------------------------------------------------------ # Register plugins to CUBE # ------------------------------------------------------------ console.rule("[bold blue]Registering plugins to CUBE") + + try: + config = await smart_expand_config( + given_config, + actions.omniclient.docker, + _get_first_username(store_clients), + ) + except ValidationError as e: + console.print(e) + raise typer.Abort() + plugin_registrations = await actions.register_plugins( config.cube.plugins, store_clients ) diff --git a/chrisomatic/spec/given.py b/chrisomatic/spec/given.py index 4cb102c..de2acd1 100644 --- a/chrisomatic/spec/given.py +++ b/chrisomatic/spec/given.py @@ -180,7 +180,7 @@ def check_plugin_compute_resources_exist(self, plugin: GivenCubePlugin) -> None: for compute_resource in plugin.compute_resource: if compute_resource not in self.compute_resource_names: raise ValidationError( - f"Error with plugin {plugin}: compute resource " + f'Error with plugin "{plugin.title}": compute resource ' f"not found in {self.compute_resource_names}" ) diff --git a/pyproject.toml b/pyproject.toml index 05624e4..db61243 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "chrisomatic" -version = "0.3.0" +version = "0.3.1" description = "ChRIS backend provisioner with Powerpointlessness" authors = ["Jennings Zhang "] license = "MIT"