handle domain templating
This commit is contained in:
parent
e0e773531a
commit
c60e11328c
2 changed files with 11 additions and 4 deletions
|
@ -5,7 +5,7 @@ terraform, dda-pallet, aws & hetzner-cloud.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from .meissa_build import meissa_init_project, stage, hetzner_api_key, tf_import_name, tf_import_resource
|
from .meissa_build import meissa_init_project, stage, hetzner_api_key, tf_import_name, tf_import_resource
|
||||||
from .dda_pallet import dda_write_target, dda_uberjar
|
from .dda_pallet import dda_write_target, dda_write_domain, dda_uberjar
|
||||||
from .terraform import tf_copy_common, tf_plan, tf_import, tf_apply, tf_output, tf_destroy, tf_read_output_json
|
from .terraform import tf_copy_common, tf_plan, tf_import, tf_apply, tf_output, tf_destroy, tf_read_output_json
|
||||||
|
|
||||||
__version__ = "${version}"
|
__version__ = "${version}"
|
|
@ -5,13 +5,20 @@ import string
|
||||||
TARGET = 'target.edn'
|
TARGET = 'target.edn'
|
||||||
TEMPLATE_TARGET_CONTENT = string.Template("""
|
TEMPLATE_TARGET_CONTENT = string.Template("""
|
||||||
{:existing [{:node-name "k8s"
|
{:existing [{:node-name "k8s"
|
||||||
:node-ip "$ip"}]
|
:node-ip "$ipv4"}]
|
||||||
:provisioning-user {:login "root"}}
|
:provisioning-user {:login "root"}}
|
||||||
""")
|
""")
|
||||||
|
|
||||||
def dda_write_target(ip):
|
def dda_write_target(ipv4):
|
||||||
with open(TARGET, "w") as output_file:
|
with open(TARGET, "w") as output_file:
|
||||||
output_file.write(TEMPLATE_TARGET_CONTENT.substitute({'ip' : ip}))
|
output_file.write(TEMPLATE_TARGET_CONTENT.substitute({'ipv4' : ipv4}))
|
||||||
|
|
||||||
|
def dda_write_domain(domain_path, substitues):
|
||||||
|
with open(domain_path, "r") as input_file:
|
||||||
|
domain_input = input_file.read()
|
||||||
|
domain_template = string.Template(domain_input)
|
||||||
|
with open('out_' + domain_path, "w") as output_file:
|
||||||
|
output_file.write(domain_template.substitute(substitues))
|
||||||
|
|
||||||
def dda_uberjar(tenant, application, spec):
|
def dda_uberjar(tenant, application, spec):
|
||||||
cmd = ['java', '-jar', '../../../target/meissa-tenant-server.jar', '--targets', TARGET,
|
cmd = ['java', '-jar', '../../../target/meissa-tenant-server.jar', '--targets', TARGET,
|
||||||
|
|
Loading…
Reference in a new issue