remove deprecated functions
This commit is contained in:
parent
b0b3f1bf55
commit
63baaaf411
9 changed files with 17 additions and 172 deletions
|
@ -9,13 +9,10 @@ from .provs_k3s_build import ProvsK3sBuild
|
|||
|
||||
# from .aws_mfa_mixin import AwsMfaMixin, add_aws_mfa_mixin_config
|
||||
from .c4k_build import C4kBuild
|
||||
from .hetzner_mixin import HetznerMixin, add_hetzner_mixin_config
|
||||
from .hetzner_mixin import HetznerMixin
|
||||
from .devops_image_build import DevopsImageBuild
|
||||
from .devops_terraform_build import (
|
||||
DevopsTerraformBuild,
|
||||
create_devops_terraform_build_config,
|
||||
)
|
||||
from .devops_build import DevopsBuild, create_devops_build_config, get_devops_build
|
||||
from .devops_terraform_build import DevopsTerraformBuild
|
||||
from .devops_build import DevopsBuild, get_devops_build
|
||||
from .credential import gopass_password_from_path, gopass_field_from_path
|
||||
from .release_mixin import ReleaseMixin
|
||||
|
||||
|
|
|
@ -1,49 +1,8 @@
|
|||
import deprecation
|
||||
from .domain import BuildType, DnsRecord
|
||||
from .devops_build import DevopsBuild
|
||||
from .credential import gopass_field_from_path, gopass_password_from_path
|
||||
from .infrastructure import ExecutionApi
|
||||
|
||||
|
||||
@deprecation.deprecated(deprecated_in="3.2", details="use direct dict instead")
|
||||
def add_c4k_mixin_config(
|
||||
config,
|
||||
c4k_config_dict,
|
||||
c4k_auth_dict,
|
||||
executable_name=None,
|
||||
grafana_cloud_user=None,
|
||||
grafana_cloud_password=None,
|
||||
grafana_cloud_url="https://prometheus-prod-01-eu-west-0.grafana.net/api/prom/push",
|
||||
):
|
||||
if not grafana_cloud_user:
|
||||
grafana_cloud_user = gopass_field_from_path(
|
||||
"server/meissa/grafana-cloud", "grafana-cloud-user"
|
||||
)
|
||||
if not grafana_cloud_password:
|
||||
grafana_cloud_password = gopass_password_from_path(
|
||||
"server/meissa/grafana-cloud"
|
||||
)
|
||||
c4k_auth_dict.update(
|
||||
{
|
||||
"mon-auth": {
|
||||
"grafana-cloud-user": grafana_cloud_user,
|
||||
"grafana-cloud-password": grafana_cloud_password,
|
||||
}
|
||||
}
|
||||
)
|
||||
c4k_config_dict.update({"mon-cfg": {"grafana-cloud-url": grafana_cloud_url}})
|
||||
config.update(
|
||||
{
|
||||
"C4kMixin": {
|
||||
"executable_name": executable_name,
|
||||
"config": c4k_config_dict,
|
||||
"auth": c4k_auth_dict,
|
||||
}
|
||||
}
|
||||
)
|
||||
return config
|
||||
|
||||
|
||||
class C4kBuild(DevopsBuild):
|
||||
def __init__(self, project, config):
|
||||
super().__init__(project, config)
|
||||
|
|
|
@ -1,24 +1,18 @@
|
|||
import deprecation
|
||||
from .python_util import execute
|
||||
from .infrastructure import CredentialsApi
|
||||
|
||||
|
||||
@deprecation.deprecated(
|
||||
deprecated_in="3.2", details="use infrastructure.CredentialsApi instead"
|
||||
)
|
||||
def gopass_field_from_path(path, field):
|
||||
credential = None
|
||||
if path and field:
|
||||
print("get field for: " + path + ", " + field)
|
||||
credential = execute(["gopass", "show", path, field])
|
||||
return credential
|
||||
api = CredentialsApi()
|
||||
return api.gopass_field_from_path(path, field)
|
||||
|
||||
|
||||
@deprecation.deprecated(
|
||||
deprecated_in="3.2", details="use infrastructure.CredentialsApi instead"
|
||||
)
|
||||
def gopass_password_from_path(path):
|
||||
credential = None
|
||||
if path:
|
||||
print("get password for: " + path)
|
||||
credential = execute(["gopass", "show", "--password", path])
|
||||
return credential
|
||||
api = CredentialsApi()
|
||||
return api.gopass_password_from_path(path)
|
||||
|
|
|
@ -3,18 +3,6 @@ from .domain import InitService, DnsRecord
|
|||
from .infrastructure import DevopsRepository, FileApi
|
||||
|
||||
|
||||
@deprecation.deprecated(deprecated_in="3.2", details="create objects direct instead")
|
||||
def create_devops_build_config(
|
||||
stage, project_root_path, module, build_dir_name="target"
|
||||
):
|
||||
return {
|
||||
"stage": stage,
|
||||
"project_root_path": project_root_path,
|
||||
"module": module,
|
||||
"build_dir_name": build_dir_name,
|
||||
}
|
||||
|
||||
|
||||
def get_devops_build(project):
|
||||
return project.get_property("build")
|
||||
|
||||
|
|
|
@ -1,34 +1,6 @@
|
|||
import deprecation
|
||||
from .domain import BuildType
|
||||
from .application import ImageBuildService
|
||||
from .devops_build import DevopsBuild, create_devops_build_config
|
||||
|
||||
|
||||
@deprecation.deprecated(deprecated_in="3.2", details="use direct dict instead")
|
||||
def create_devops_docker_build_config(
|
||||
stage,
|
||||
project_root_path,
|
||||
module,
|
||||
dockerhub_user,
|
||||
dockerhub_password,
|
||||
build_dir_name="target",
|
||||
use_package_common_files=True,
|
||||
build_commons_path=None,
|
||||
docker_build_commons_dir_name="docker",
|
||||
docker_publish_tag=None,
|
||||
):
|
||||
ret = create_devops_build_config(stage, project_root_path, module, build_dir_name)
|
||||
ret.update(
|
||||
{
|
||||
"dockerhub_user": dockerhub_user,
|
||||
"dockerhub_password": dockerhub_password,
|
||||
"use_package_common_files": use_package_common_files,
|
||||
"docker_build_commons_dir_name": docker_build_commons_dir_name,
|
||||
"build_commons_path": build_commons_path,
|
||||
"docker_publish_tag": docker_publish_tag,
|
||||
}
|
||||
)
|
||||
return ret
|
||||
from .devops_build import DevopsBuild
|
||||
|
||||
|
||||
class DevopsImageBuild(DevopsBuild):
|
||||
|
|
|
@ -1,43 +1,7 @@
|
|||
from .devops_build import DevopsBuild, create_devops_build_config
|
||||
from .devops_build import DevopsBuild
|
||||
from .application import TerraformService
|
||||
|
||||
|
||||
def create_devops_terraform_build_config(
|
||||
stage,
|
||||
project_root_path,
|
||||
module,
|
||||
additional_vars,
|
||||
build_dir_name="target",
|
||||
output_json_name=None,
|
||||
use_workspace=True,
|
||||
use_package_common_files=True,
|
||||
build_commons_path=None,
|
||||
terraform_build_commons_dir_name="terraform",
|
||||
debug_print_terraform_command=False,
|
||||
additional_tfvar_files=None,
|
||||
terraform_semantic_version="1.0.8",
|
||||
):
|
||||
if not output_json_name:
|
||||
output_json_name = "out_" + module + ".json"
|
||||
if not additional_tfvar_files:
|
||||
additional_tfvar_files = []
|
||||
ret = create_devops_build_config(stage, project_root_path, module, build_dir_name)
|
||||
ret.update(
|
||||
{
|
||||
"additional_vars": additional_vars,
|
||||
"output_json_name": output_json_name,
|
||||
"use_workspace": use_workspace,
|
||||
"use_package_common_files": use_package_common_files,
|
||||
"build_commons_path": build_commons_path,
|
||||
"terraform_build_commons_dir_name": terraform_build_commons_dir_name,
|
||||
"debug_print_terraform_command": debug_print_terraform_command,
|
||||
"additional_tfvar_files": additional_tfvar_files,
|
||||
"terraform_semantic_version": terraform_semantic_version,
|
||||
}
|
||||
)
|
||||
return ret
|
||||
|
||||
|
||||
class DevopsTerraformBuild(DevopsBuild):
|
||||
def __init__(self, project, config):
|
||||
inp = config.copy()
|
||||
|
|
|
@ -1,27 +1,20 @@
|
|||
from .devops_terraform_build import DevopsTerraformBuild
|
||||
|
||||
|
||||
def add_hetzner_mixin_config(config, hetzner_api_key):
|
||||
config.update({'HetznerMixin':
|
||||
{'hetzner_api_key': hetzner_api_key}})
|
||||
return config
|
||||
|
||||
|
||||
class HetznerMixin(DevopsTerraformBuild):
|
||||
|
||||
def __init__(self, project, config):
|
||||
super().__init__(project, config)
|
||||
hetzner_mixin_config = config['HetznerMixin']
|
||||
self.hetzner_api_key = hetzner_mixin_config['hetzner_api_key']
|
||||
hetzner_mixin_config = config["HetznerMixin"]
|
||||
self.hetzner_api_key = hetzner_mixin_config["hetzner_api_key"]
|
||||
|
||||
def project_vars(self):
|
||||
ret = super().project_vars()
|
||||
if self.hetzner_api_key:
|
||||
ret['hetzner_api_key'] = self.hetzner_api_key
|
||||
ret["hetzner_api_key"] = self.hetzner_api_key
|
||||
return ret
|
||||
|
||||
def copy_build_resources_from_package(self):
|
||||
super().copy_build_resources_from_package()
|
||||
self.copy_build_resource_file_from_package('provider_registry.tf')
|
||||
self.copy_build_resource_file_from_package('hetzner_provider.tf')
|
||||
self.copy_build_resource_file_from_package('hetzner_mixin_vars.tf')
|
||||
self.copy_build_resource_file_from_package("provider_registry.tf")
|
||||
self.copy_build_resource_file_from_package("hetzner_provider.tf")
|
||||
self.copy_build_resource_file_from_package("hetzner_mixin_vars.tf")
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
from subprocess import check_output, Popen, PIPE
|
||||
import deprecation
|
||||
|
||||
|
||||
@deprecation.deprecated(deprecated_in="3.2", details="use ExecutionApi instead")
|
||||
def execute(cmd, shell=False):
|
||||
output = check_output(cmd, encoding="UTF-8", shell=shell)
|
||||
return output.rstrip()
|
||||
|
||||
|
||||
@deprecation.deprecated(deprecated_in="3.2", details="use ExecutionApi instead")
|
||||
def execute_live(cmd):
|
||||
process = Popen(cmd, stdout=PIPE)
|
||||
for line in iter(process.stdout.readline, b""):
|
||||
print(line.decode("utf-8"), end="")
|
||||
process.stdout.close()
|
||||
process.wait()
|
||||
|
||||
|
||||
@deprecation.deprecated(deprecated_in="3.2", details="use domain.filter_none instead")
|
||||
def filter_none(list_to_filter):
|
||||
return [x for x in list_to_filter if x is not None]
|
|
@ -1,7 +1,7 @@
|
|||
import os
|
||||
from pybuilder.core import Project
|
||||
from src.main.python.ddadevops.domain import DnsRecord
|
||||
from src.main.python.ddadevops.c4k_build import C4kBuild, add_c4k_mixin_config
|
||||
from src.main.python.ddadevops.c4k_build import C4kBuild
|
||||
from .domain.helper import (
|
||||
CredentialsApiMock,
|
||||
devops_config,
|
||||
|
|
Loading…
Reference in a new issue