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:
parent
ef63c0de14
commit
ff663f7835
1 changed files with 9 additions and 5 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue