From ff663f7835237eb4b5948aa0acd55f394e3ebc55 Mon Sep 17 00:00:00 2001 From: Enno Tensing Date: Tue, 29 Jul 2025 09:31:52 +0200 Subject: [PATCH] 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 --- generate/generate.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/generate/generate.py b/generate/generate.py index 68e2c2c..1c20f91 100644 --- a/generate/generate.py +++ b/generate/generate.py @@ -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