refactoring: rename C4kBuild -> C4k
This commit is contained in:
parent
5ff4a4c9bb
commit
1bcc8908e9
9 changed files with 22 additions and 22 deletions
|
@ -71,7 +71,7 @@ classDiagram
|
|||
}
|
||||
|
||||
class C4kMixin {
|
||||
// C4kMixin -> C4kBuild
|
||||
// C4kMixin -> C4k
|
||||
def write_c4k_config()
|
||||
def write_c4k_auth()
|
||||
c4k_apply(dry_run=False)
|
||||
|
|
|
@ -12,7 +12,7 @@ classDiagram
|
|||
|
||||
class Docker
|
||||
|
||||
class C4kBuild {
|
||||
class C4k {
|
||||
executabel_name
|
||||
c4k_mixin_config
|
||||
c4k_mixin_auth
|
||||
|
@ -24,7 +24,7 @@ classDiagram
|
|||
ipv6
|
||||
}
|
||||
|
||||
C4kBuild *-- DnsRecord
|
||||
C4k *-- DnsRecord
|
||||
|
||||
```
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ from .devops_terraform_build import DevopsTerraformBuild, create_devops_terrafor
|
|||
from .devops_build import DevopsBuild, create_devops_build_config, get_devops_build, get_tag_from_latest_commit
|
||||
from .credential import gopass_password_from_path, gopass_field_from_path
|
||||
|
||||
from .domain import Validateable, DnsRecord, Devops, Docker, C4kBuild
|
||||
from .domain import Validateable, DnsRecord, Devops, Docker, C4k
|
||||
from .application import DockerBuildService
|
||||
from .infrastructure import ProjectRepository, ResourceApi, FileApi, DockerApi, ExecutionApi
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from .domain import Devops, Docker, C4kBuild
|
||||
from .domain import Devops, Docker
|
||||
from .infrastructure import FileApi, ResourceApi, DockerApi, ExecutionApi
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import deprecation
|
||||
from .domain import C4kBuild, DnsRecord
|
||||
from .domain import C4k, DnsRecord
|
||||
from .devops_build import DevopsBuild
|
||||
from .credential import gopass_field_from_path, gopass_password_from_path
|
||||
from .infrastructure import ProjectRepository, FileApi, ExecutionApi
|
||||
|
@ -50,27 +50,27 @@ class C4kMixin(DevopsBuild):
|
|||
def __init__(self, project, config):
|
||||
super().__init__(project, config)
|
||||
self.execution_api = ExecutionApi()
|
||||
c4k_build = C4kBuild(config)
|
||||
self.repo.set_c4k_build(self.project, c4k_build)
|
||||
c4k_build = C4k(config)
|
||||
self.repo.set_c4k(self.project, c4k_build)
|
||||
|
||||
def update_runtime_config(self, dns_record: DnsRecord):
|
||||
c4k_build = self.repo.get_c4k_build(self.project)
|
||||
c4k_build = self.repo.get_c4k(self.project)
|
||||
c4k_build.update_runtime_config(dns_record)
|
||||
self.repo.set_c4k_build(self.project, c4k_build)
|
||||
self.repo.set_c4k(self.project, c4k_build)
|
||||
|
||||
def write_c4k_config(self):
|
||||
build = self.repo.get_devops(self.project)
|
||||
c4k_build = self.repo.get_c4k_build(self.project)
|
||||
c4k_build = self.repo.get_c4k(self.project)
|
||||
path = build.build_path() + "/out_c4k_config.yaml"
|
||||
self.file_api.write_yaml_to_file(path, c4k_build.config())
|
||||
|
||||
def write_c4k_auth(self):
|
||||
build = self.repo.get_devops(self.project)
|
||||
c4k_build = self.repo.get_c4k_build(self.project)
|
||||
c4k_build = self.repo.get_c4k(self.project)
|
||||
path = build.build_path() + "/out_c4k_auth.yaml"
|
||||
self.file_api.write_yaml_to_file(path, c4k_build.c4k_mixin_auth)
|
||||
|
||||
def c4k_apply(self, dry_run=False):
|
||||
build = self.repo.get_devops(self.project)
|
||||
c4k_build = self.repo.get_c4k_build(self.project)
|
||||
c4k_build = self.repo.get_c4k(self.project)
|
||||
return self.execution_api.execute(c4k_build.command(build), dry_run)
|
||||
|
|
|
@ -78,7 +78,7 @@ class Docker(Validateable):
|
|||
return "/".join(filter_none(list)) + "/"
|
||||
|
||||
|
||||
class C4kBuild(Validateable):
|
||||
class C4k(Validateable):
|
||||
def __init__(self, config: map):
|
||||
tmp_executabel_name = config["C4kMixin"]["executabel_name"]
|
||||
if not tmp_executabel_name:
|
||||
|
|
|
@ -3,7 +3,7 @@ from sys import stdout
|
|||
from pkg_resources import resource_string
|
||||
from os import chmod
|
||||
import yaml
|
||||
from .domain import Devops, Docker, C4kBuild
|
||||
from .domain import Devops, Docker, C4k
|
||||
from .python_util import execute
|
||||
|
||||
|
||||
|
@ -20,10 +20,10 @@ class ProjectRepository:
|
|||
def set_docker(self, project, build: Docker):
|
||||
project.set_property("docker_build", build)
|
||||
|
||||
def get_c4k_build(self, project) -> C4kBuild:
|
||||
def get_c4k(self, project) -> C4k:
|
||||
return project.get_property("c4k_build")
|
||||
|
||||
def set_c4k_build(self, project, build: C4kBuild):
|
||||
def set_c4k(self, project, build: C4k):
|
||||
project.set_property("c4k_build", build)
|
||||
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ def test_c4k_mixin(tmp_path):
|
|||
assert mixin.build_path() == f'{tmp_path_str}/{build_dir}/{project_name}/{module_name}'
|
||||
|
||||
mixin.update_runtime_config(DnsRecord('test.de', ipv6="1::"))
|
||||
sut = mixin.repo.get_c4k_build(mixin.project)
|
||||
sut = mixin.repo.get_c4k(mixin.project)
|
||||
assert 'fqdn' in sut.config()
|
||||
assert 'mon-cfg' in sut.config()
|
||||
assert 'mon-auth' in sut.c4k_mixin_auth
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
from pybuilder.core import Project
|
||||
from src.main.python.ddadevops.domain import Validateable, DnsRecord, C4kBuild, Devops
|
||||
from src.main.python.ddadevops.domain import Validateable, DnsRecord, C4k, Devops
|
||||
from src.main.python.ddadevops.c4k_mixin import add_c4k_mixin_config
|
||||
|
||||
|
||||
|
@ -78,7 +78,7 @@ def test_c4k_build_should_update_fqdn(tmp_path):
|
|||
grafana_cloud_password="password",
|
||||
)
|
||||
build = Devops(project_config)
|
||||
sut = C4kBuild(project_config)
|
||||
sut = C4k(project_config)
|
||||
sut.update_runtime_config(DnsRecord("test.de", ipv6="1::"))
|
||||
|
||||
assert {
|
||||
|
@ -118,7 +118,7 @@ def test_c4k_build_should_calculate_command(tmp_path):
|
|||
grafana_cloud_password="password",
|
||||
)
|
||||
build = Devops(project_config)
|
||||
sut = C4kBuild(project_config)
|
||||
sut = C4k(project_config)
|
||||
assert (
|
||||
"c4k-module-standalone.jar "
|
||||
+ "/target/name/module/out_c4k_config.yaml "
|
||||
|
@ -143,7 +143,7 @@ def test_c4k_build_should_calculate_command(tmp_path):
|
|||
grafana_cloud_password="password",
|
||||
)
|
||||
build = Devops(project_config)
|
||||
sut = C4kBuild(project_config)
|
||||
sut = C4k(project_config)
|
||||
assert (
|
||||
"c4k-executabel_name-standalone.jar "
|
||||
+ "/target/name/module/out_c4k_config.yaml "
|
||||
|
|
Loading…
Reference in a new issue