Skip to content

Commit f6be823

Browse files
committed
Fixes label issues
- #8 - #9
1 parent 6591424 commit f6be823

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

chrisomatic/core/docker.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
from enum import Enum
1313

1414

15-
_CHRIS_ROLE = {"label": {"org.chrisproject.role=ChRIS ultron backEnd": True}}
15+
BACKEND_CONTAINER_LABEL = "org.chrisproject.role=ChRIS_ultron_backEnd"
16+
_CHRIS_ROLE = {"label": {BACKEND_CONTAINER_LABEL: True}}
1617

1718

1819
async def find_cube(

chrisomatic/core/superuser.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,19 @@
33

44
import aiodocker
55
from chrisomatic.spec.common import User
6-
from chrisomatic.core.docker import find_cube
6+
from chrisomatic.core.docker import find_cube, BACKEND_CONTAINER_LABEL
77

88

99
async def create_superuser(docker: Optional[aiodocker.Docker], user: User) -> None:
1010
if docker is None:
1111
raise SuperuserCreationError(
1212
"Cannot create superuser without connection to Docker."
1313
)
14-
cube = await find_cube(docker)
14+
if (cube := await find_cube(docker)) is None:
15+
raise SuperuserCreationError(
16+
f"No container found on host {docker.docker_host} "
17+
f"with label {BACKEND_CONTAINER_LABEL}"
18+
)
1519
script = cleandoc(
1620
f"""
1721
from django.contrib.auth.models import User

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "chrisomatic"
3-
version = "0.5.0.a1"
3+
version = "0.5.0.a2"
44
description = "ChRIS backend provisioner with Powerpointlessness"
55
authors = ["Jennings Zhang <[email protected]>"]
66
license = "MIT"

0 commit comments

Comments
 (0)