mirror of
https://github.com/Sheldan/abstracto.git
synced 2026-03-20 04:31:06 +00:00
[AB-xxx] fixing deployment of zip artifacts named the same name being deployed twice
This commit is contained in:
@@ -59,15 +59,18 @@ if not use_folder:
|
|||||||
if deploy_templates:
|
if deploy_templates:
|
||||||
print("Deploying templates.")
|
print("Deploying templates.")
|
||||||
for template_artifact in artifact_config['template_artifacts']:
|
for template_artifact in artifact_config['template_artifacts']:
|
||||||
|
folder_name = template_artifact + "-templates"
|
||||||
|
os.mkdir(folder_name)
|
||||||
with ZipFile('templates/' + template_artifact + '.zip', 'r') as template_zip:
|
with ZipFile('templates/' + template_artifact + '.zip', 'r') as template_zip:
|
||||||
template_zip.extractall(template_artifact)
|
template_zip.extractall(folder_name)
|
||||||
templates_deploy.deploy_template_folder(db_config, template_artifact)
|
templates_deploy.deploy_template_folder(db_config, folder_name)
|
||||||
|
|
||||||
print("Deploying translation templates")
|
print("Deploying translation templates")
|
||||||
for template_artifact in artifact_config['translation_artifacts']:
|
for template_artifact in artifact_config['translation_artifacts']:
|
||||||
|
folder_name = template_artifact + "-translations"
|
||||||
with ZipFile('translations/' + template_artifact + '.zip', 'r') as template_zip:
|
with ZipFile('translations/' + template_artifact + '.zip', 'r') as template_zip:
|
||||||
template_zip.extractall(template_artifact)
|
template_zip.extractall(folder_name)
|
||||||
templates_deploy.deploy_template_folder(db_config, template_artifact)
|
templates_deploy.deploy_template_folder(db_config, folder_name)
|
||||||
|
|
||||||
if use_folder:
|
if use_folder:
|
||||||
print("Only deploying folder.")
|
print("Only deploying folder.")
|
||||||
|
|||||||
@@ -23,7 +23,8 @@ def deploy_template_folder(db_config, folder):
|
|||||||
print('Deploying %s templates from folder %s' % (len(templates), folder))
|
print('Deploying %s templates from folder %s' % (len(templates), folder))
|
||||||
|
|
||||||
with engine.connect() as con:
|
with engine.connect() as con:
|
||||||
statement = text("""INSERT INTO template(key, content, last_modified) VALUES(:key, :content, NOW()) ON CONFLICT (key) DO UPDATE SET content = :content""")
|
with con.begin():
|
||||||
|
statement = text("""INSERT INTO template(key, content, last_modified) VALUES(:key, :content, NOW()) ON CONFLICT (key) DO UPDATE SET content = :content""")
|
||||||
|
|
||||||
for line in templates:
|
for line in templates:
|
||||||
con.execute(statement, **line)
|
con.execute(statement, **line)
|
||||||
|
|||||||
Reference in New Issue
Block a user