Add entrypoint support and quote commands
This commit is contained in:
parent
55977c0dc7
commit
602c3a45cf
8
main.py
8
main.py
@ -135,14 +135,18 @@ def write_service_units(args, yaml_dict):
|
|||||||
if "command" in service:
|
if "command" in service:
|
||||||
enforce_list("command", service)
|
enforce_list("command", service)
|
||||||
command = service["command"]
|
command = service["command"]
|
||||||
cmd = command[0]
|
cmd = f'"{command[0]}"'
|
||||||
if len(command) > 1:
|
if len(command) > 1:
|
||||||
cmd += " \\\n"
|
cmd += " \\\n"
|
||||||
for i, cmd_part in enumerate(command[1:]):
|
for i, cmd_part in enumerate(command[1:]):
|
||||||
cmd += f" {cmd_part}"
|
cmd += f' "{cmd_part}"'
|
||||||
if i < len(command) - 2:
|
if i < len(command) - 2:
|
||||||
cmd += " \\\n"
|
cmd += " \\\n"
|
||||||
unit_file["Container"]["Exec"] = cmd
|
unit_file["Container"]["Exec"] = cmd
|
||||||
|
if "entrypoint" in service:
|
||||||
|
if not isinstance(service["entrypoint"], str):
|
||||||
|
abort(f"Only supporting str for entrypoint for now. Got {type(service['entrypoint'])}")
|
||||||
|
unit_file["Container"]["Entrypoint"] = service["entrypoint"]
|
||||||
if "labels" in service:
|
if "labels" in service:
|
||||||
enforce_list("labels", service)
|
enforce_list("labels", service)
|
||||||
unit_file["Container"]["Label"] = service["labels"]
|
unit_file["Container"]["Label"] = service["labels"]
|
||||||
|
Loading…
Reference in New Issue
Block a user