fix mypy issues
This commit is contained in:
parent
cfa05beae4
commit
32847914a7
6 changed files with 18 additions and 10 deletions
|
@ -37,7 +37,7 @@ class ImageBuildService:
|
|||
def image(self, docker: Image):
|
||||
self.docker_api.image(docker.devops.name, docker.devops.build_path())
|
||||
|
||||
def drun(self, docker: Devops):
|
||||
def drun(self, docker: Image):
|
||||
self.docker_api.drun(docker.devops.name)
|
||||
|
||||
def dockerhub_login(self, docker: Image):
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import deprecation
|
||||
from typing import Optional
|
||||
from subprocess import run, CalledProcessError
|
||||
from .domain import Devops
|
||||
from .infrastructure import ProjectRepository, FileApi
|
||||
|
@ -35,11 +36,11 @@ def get_tag_from_latest_commit():
|
|||
|
||||
|
||||
class DevopsBuild:
|
||||
def __init__(self, project, config: map = None, devops: Devops = None):
|
||||
def __init__(self, project, config: Optional[dict] = None, devops: Optional[Devops] = None):
|
||||
self.project = project
|
||||
self.file_api = FileApi()
|
||||
self.repo = ProjectRepository()
|
||||
if not devops:
|
||||
if not devops and config:
|
||||
devops = Devops(
|
||||
stage=config["stage"],
|
||||
project_root_path=config["project_root_path"],
|
||||
|
@ -47,6 +48,9 @@ class DevopsBuild:
|
|||
name=project.name,
|
||||
build_dir_name=config["build_dir_name"],
|
||||
)
|
||||
else:
|
||||
raise Exception("Build parameters could not be set!")
|
||||
|
||||
self.repo.set_devops(self.project, devops)
|
||||
self.repo.set_build(self.project, self)
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import deprecation
|
||||
from typing import Optional
|
||||
from .domain import Image
|
||||
from .application import ImageBuildService
|
||||
from .devops_build import DevopsBuild, create_devops_build_config
|
||||
|
@ -32,18 +33,21 @@ def create_devops_docker_build_config(
|
|||
|
||||
|
||||
class DevopsImageBuild(DevopsBuild):
|
||||
def __init__(self, project, config: map = None, image: Image = None):
|
||||
def __init__(self, project, config: Optional[dict] = None, image: Optional[Image] = None):
|
||||
self.image_build_service = ImageBuildService()
|
||||
if not image:
|
||||
if not config:
|
||||
raise Exception("Image parameters could not be set.")
|
||||
super().__init__(project, config=config)
|
||||
image = Image(
|
||||
dockerhub_user=config["dockerhub_user"],
|
||||
dockerhub_password=config["dockerhub_password"],
|
||||
devops=self.repo.get_devops(project),
|
||||
use_package_common_files=config["use_package_common_files"],
|
||||
build_commons_path=config["build_commons_path"],
|
||||
docker_build_commons_dir_name=config["docker_build_commons_dir_name"],
|
||||
docker_publish_tag=config["docker_publish_tag"],
|
||||
)
|
||||
super().__init__(project, config=config)
|
||||
else:
|
||||
super().__init__(project, devops=image.devops)
|
||||
self.repo.set_docker(self.project, image)
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import deprecation
|
||||
from typing import List
|
||||
from typing import List, Optional
|
||||
from .common import (
|
||||
Validateable,
|
||||
DnsRecord,
|
||||
|
@ -7,7 +6,7 @@ from .common import (
|
|||
)
|
||||
|
||||
class C4k(Validateable):
|
||||
def __init__(self, config: map):
|
||||
def __init__(self, config: dict):
|
||||
tmp_executabel_name = config["C4kMixin"]["executabel_name"]
|
||||
if not tmp_executabel_name:
|
||||
tmp_executabel_name = config["module"]
|
||||
|
@ -17,7 +16,7 @@ class C4k(Validateable):
|
|||
tmp = self.c4k_mixin_config["mon-cfg"]
|
||||
tmp.update({"cluster-name": config["module"], "cluster-stage": config["stage"]})
|
||||
self.c4k_mixin_config.update({"mon-cfg": tmp})
|
||||
self.dns_record = None
|
||||
self.dns_record: Optional[DnsRecord] = None
|
||||
|
||||
# TODO: these functions should be located at TerraformBuild later on.
|
||||
def update_runtime_config(self, dns_record: DnsRecord):
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from typing import Optional
|
||||
from .common import (
|
||||
filter_none,
|
||||
Validateable,
|
||||
|
|
|
@ -111,7 +111,7 @@ class ImageApi:
|
|||
|
||||
|
||||
class ExecutionApi:
|
||||
def execute(command: str, dry_run=False):
|
||||
def execute(self, command: str, dry_run=False):
|
||||
output = ""
|
||||
if dry_run:
|
||||
print(command)
|
||||
|
|
Loading…
Reference in a new issue