1
0
Fork 0

generate: generate: Handle empty control scripts

When a given control script is empty, because the current config is
missing a value for said script or is malformed, a script with only
the shebang was written. Change it, so that it now executes true.

Signed-off-by: Enno Tensing <tenno@suij.in>
This commit is contained in:
Enno Tensing 2025-07-29 09:31:52 +02:00
parent ef63c0de14
commit ff663f7835
Signed by: tenno
GPG key ID: 95265603BD36E66C

View file

@ -98,13 +98,17 @@ def main() -> None:
Path(base).mkdir()
for script, method in scripts.items():
s = Path(f"{base}/{script}")
script_content = ""
if script == "create":
script_content += ct.create_volumes()
script_content += ct.create_secrets()
script_content += ct.create_environment()
script_content += method()
if script_content == "":
script_content = "true"
with s.open("w+", encoding="utf-8") as f:
f.write("#!/bin/sh\n")
if script == "create":
f.write(ct.create_volumes())
f.write(ct.create_secrets())
f.write(ct.create_environment())
f.write(method())
f.write(script_content)
s.chmod(
stat.S_IRWXU
| stat.S_IRGRP