[AB-152] adding optional parameter to deploy config script in order to deploy template config

This commit is contained in:
Sheldan
2020-11-02 15:42:43 +01:00
parent a5b2e40c6b
commit c60cdb9d98

View File

@@ -6,9 +6,15 @@ import liquibase_deploy
from zipfile import ZipFile from zipfile import ZipFile
import sys import sys
if len(sys.argv) != 3: if len(sys.argv) < 3:
sys.exit('Wrong amount of parameters.') sys.exit('Wrong amount of parameters.')
use_folder = False
local_folder = None
if len(sys.argv) == 4:
use_folder = True
local_folder = sys.argv[3]
deploy_templates = sys.argv[1] == 'yes' deploy_templates = sys.argv[1] == 'yes'
deploy_liquibase = sys.argv[2] == 'yes' deploy_liquibase = sys.argv[2] == 'yes'
@@ -20,6 +26,8 @@ class DbConfig:
self.user = os.getenv('DB_USER') self.user = os.getenv('DB_USER')
self.password = os.getenv('DB_PASS') self.password = os.getenv('DB_PASS')
db_config = DbConfig()
if not use_folder:
postgres_driver_path = os.getenv('POSTGRES_DRIVER') postgres_driver_path = os.getenv('POSTGRES_DRIVER')
liquibase_path = os.getenv('LIQUIBASE_PATH') liquibase_path = os.getenv('LIQUIBASE_PATH')
@@ -27,7 +35,6 @@ liquibase_path = os.getenv('LIQUIBASE_PATH')
with open('artifact_versions.json') as artifact_config_file: with open('artifact_versions.json') as artifact_config_file:
artifact_config = json.load(artifact_config_file) artifact_config = json.load(artifact_config_file)
db_config = DbConfig()
templateLoader = jinja2.FileSystemLoader(searchpath="/python/templates") templateLoader = jinja2.FileSystemLoader(searchpath="/python/templates")
@@ -60,3 +67,5 @@ if deploy_templates:
template_zip.extractall(template_artifact) template_zip.extractall(template_artifact)
templates_deploy.deploy_template_folder(db_config, template_artifact) templates_deploy.deploy_template_folder(db_config, template_artifact)
if use_folder:
templates_deploy.deploy_template_folder(db_config, local_folder)