Skip to content

Commit

Permalink
Catch ValidationError during full expand
Browse files Browse the repository at this point in the history
  • Loading branch information
jennydaman committed Jul 15, 2022
1 parent 72247eb commit 8743450
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
20 changes: 12 additions & 8 deletions chrisomatic/cli/agenda.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
)
Expand Down
2 changes: 1 addition & 1 deletion chrisomatic/spec/given.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
)

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 <Jennings.Zhang@childrens.harvard.edu>"]
license = "MIT"
Expand Down

0 comments on commit 8743450

Please sign in to comment.