Skip to content

Commit

Permalink
Fixes label issues
Browse files Browse the repository at this point in the history
- #8
- #9
  • Loading branch information
jennydaman committed Jul 7, 2023
1 parent 6591424 commit f6be823
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
3 changes: 2 additions & 1 deletion chrisomatic/core/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
from enum import Enum


_CHRIS_ROLE = {"label": {"org.chrisproject.role=ChRIS ultron backEnd": True}}
BACKEND_CONTAINER_LABEL = "org.chrisproject.role=ChRIS_ultron_backEnd"
_CHRIS_ROLE = {"label": {BACKEND_CONTAINER_LABEL: True}}


async def find_cube(
Expand Down
8 changes: 6 additions & 2 deletions chrisomatic/core/superuser.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,19 @@

import aiodocker
from chrisomatic.spec.common import User
from chrisomatic.core.docker import find_cube
from chrisomatic.core.docker import find_cube, BACKEND_CONTAINER_LABEL


async def create_superuser(docker: Optional[aiodocker.Docker], user: User) -> None:
if docker is None:
raise SuperuserCreationError(
"Cannot create superuser without connection to Docker."
)
cube = await find_cube(docker)
if (cube := await find_cube(docker)) is None:
raise SuperuserCreationError(
f"No container found on host {docker.docker_host} "
f"with label {BACKEND_CONTAINER_LABEL}"
)
script = cleandoc(
f"""
from django.contrib.auth.models import User
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.5.0.a1"
version = "0.5.0.a2"
description = "ChRIS backend provisioner with Powerpointlessness"
authors = ["Jennings Zhang <[email protected]>"]
license = "MIT"
Expand Down

0 comments on commit f6be823

Please sign in to comment.