remove dda-tenant support

This commit is contained in:
jerger 2022-12-09 14:42:51 +01:00
parent 29785a14fd
commit 80947e6684
2 changed files with 1 additions and 75 deletions

View file

@ -9,11 +9,11 @@ from .devops_build import DevopsBuild, create_devops_build_config, get_devops_bu
from .devops_terraform_build import DevopsTerraformBuild, create_devops_terraform_build_config
from .devops_docker_build import DevopsDockerBuild, create_devops_docker_build_config
from .hetzner_mixin import HetznerMixin, add_hetzner_mixin_config
from .digitalocean_mixin import DigitaloceanMixin, add_digitalocean_mixin_config
from .exoscale_mixin import ExoscaleMixin, add_exoscale_mixin_config
from .aws_backend_properties_mixin import AwsBackendPropertiesMixin, add_aws_backend_properties_mixin_config
from .aws_mfa_mixin import AwsMfaMixin, add_aws_mfa_mixin_config
from .aws_rds_pg_mixin import AwsRdsPgMixin, add_aws_rds_pg_mixin_config
from .dda_tenant_mixin import DdaTenantMixin, add_dda_tenant_mixin_config
from .dda_simple_mixin import DdaSimpleMixin, add_dda_simple_mixin_config
from .provs_k3s_mixin import ProvsK3sMixin, add_provs_k3s_mixin_config
from .python_util import execute

View file

@ -1,74 +0,0 @@
from string import Template
from subprocess import run
from .python_util import *
from .devops_build import DevopsBuild
def add_dda_tenant_mixin_config(config, tenant, application, domain_file_name):
config.update({'DdaTenantMixin':
{'tenant': tenant,
'application': application,
'domain_file_name': domain_file_name,
'target_edn_name': 'target.edn',
'jar_file': 'target/meissa-tenant-server.jar',
'target_template':
"""
{:existing [{:node-name "$node_name"
:node-ip "$ipv4"}]
:provisioning-user {:login "root"}}
""", }})
return config
class DdaTenantMixin(DevopsBuild):
def __init__(self, project, config):
super().__init__(project, config)
dda_pallet_mixin_config = config['DdaTenantMixin']
self.tenant = dda_pallet_mixin_config['tenant']
self.application = dda_pallet_mixin_config['application']
self.domain_file_name = dda_pallet_mixin_config['domain_file_name']
self.target_edn_name = dda_pallet_mixin_config['target_edn_name']
self.jar_file = dda_pallet_mixin_config['jar_file']
self.target_template = Template(
dda_pallet_mixin_config['target_template'])
def initialize_build_dir(self):
super().initialize_build_dir()
run('cp *.edn ' + self.build_path(), shell=True)
def dda_write_target(self, node_name, ipv4):
with open(self.build_path() + '/' + self.target_edn_name, "w") as output_file:
output_file.write(
self.target_template.substitute({'ipv4': ipv4, 'node_name': node_name}))
def dda_write_domain(self, substitues):
with open(self.build_path() + '/' + self.domain_file_name, "r") as input_file:
domain_input=input_file.read()
domain_template=Template(domain_input)
with open(self.build_path() + '/out_' + self.domain_file_name, "w") as output_file:
output_file.write(domain_template.substitute(substitues))
def dda_uberjar(self, configure_switch = None):
if configure_switch:
cmd=['java', '-jar', self.project_root_path + '/' + self.jar_file,
'--targets', self.build_path() + '/' + self.target_edn_name,
'--tenant', self.tenant, '--application', self.application,
'--configure',
self.build_path() + '/out_' + self.domain_file_name]
else:
cmd = ['java', '-jar', self.project_root_path + '/' + self.jar_file,
'--targets', self.build_path() + '/' + self.target_edn_name,
'--tenant', self.tenant, '--application', self.application,
self.build_path() + '/out_' + self.domain_file_name]
prn_cmd = list(cmd)
print(" ".join(prn_cmd))
output = execute(cmd)
print(output)
return output
def dda_install(self):
return self.dda_uberjar()
def dda_configure(self):
return self.dda_uberjar(True)