[manage.py] Fix (?) templates rendering issue

This commit is contained in:
Viyurz 2024-10-01 14:06:30 +02:00
parent c5c8961264
commit dae1e67dce
Signed by: Viyurz
SSH key fingerprint: SHA256:IskOHTmhHSJIvAt04N6aaxd5SZCVWW1Guf9tEcxIMj8

View file

@ -48,13 +48,11 @@ def pullProj(project):
def renderFile(templateFile):
print(f"Rendering file {templateFile}.")
renderedFile = re.sub('\\.mako$', '.rendered', templateFile)
renderedFilename = re.sub('\\.mako$', '.rendered', templateFile)
template = Template(filename=templateFile)
descriptor = os.open(renderedFile, os.O_WRONLY|os.O_CREAT, 0o640)
outputFile = open(descriptor, "w")
outputFile = open(renderedFilename, "w")
outputFile.write(template.render(env=env, secrets=secrets))
outputFile.close()
@ -123,7 +121,9 @@ def setupProj(project):
for templateFile in glob(f"projects/{project}/*.mako", include_hidden=True):
renderFile(templateFile)
setOwner(re.sub('\\.mako$', '.rendered', templateFile), env['host_uid'], getUid(project))
renderedFilename = re.sub('\\.mako$', '.rendered', templateFile)
setPerms(renderedFilename, 640)
setOwner(renderedFilename, env['host_uid'], getUid(project))
upProj(project)