fixed key error on optional() for creation steps

This commit is contained in:
Mathieu Broillet 2023-06-20 15:15:15 +02:00
parent a659323779
commit 4ec9c86b2c
No known key found for this signature in database
GPG Key ID: 7D4F25BC50A0AA32

View File

@ -156,23 +156,23 @@ def run_steps(lxc: LXC):
case "file_copy": case "file_copy":
lxc.pve.copy_file_to_lxc(lxc, get_path(lxc, step["path"]), step["destination"]) lxc.pve.copy_file_to_lxc(lxc, get_path(lxc, step["path"]), step["destination"])
case "folder": case "folder":
lxc.create_directory(step["path"], optional(step["permission"], 755)) lxc.create_directory(step["path"], step.get("permission", 755))
case "folder_copy": case "folder_copy":
lxc.pve.copy_folder_to_lxc(lxc, get_path(lxc, step["path"]), step["destination"]) lxc.pve.copy_folder_to_lxc(lxc, get_path(lxc, step["path"]), step["destination"])
case "command": case "command":
lxc.run_command(command=step["command"], working_directory=optional(step["working_directory"], None), lxc.run_command(command=step["command"], working_directory=step.get("working_directory"),
return_status_code=True) return_status_code=True)
case "docker": case "docker":
lxc.run_docker_command(step["container"], step["command"]) lxc.run_docker_command(step["container"], step["command"])
case "docker_compose": case "docker_compose":
lxc.run_docker_compose_command(command=step["command"], lxc.run_docker_compose_command(command=step["command"],
working_directory=optional(step["working_directory"], None)) working_directory=step.get("working_directory"))
case "git": case "git":
lxc.run_command(command=f"git clone {step['url']} {step['destination']}", return_status_code=True) lxc.run_command(command=f"git clone {step['url']} {step['destination']}", return_status_code=True)
case "download": case "download":
lxc.download_file(step["url"], step["destination"]) lxc.download_file(step["url"], step["destination"])
case "unzip": case "unzip":
lxc.unzip_file(step["path"], optional(step["destination"], None)) lxc.unzip_file(step["path"], step.get("destination"))
case "install-package": case "install-package":
lxc.install_package(step["package"]) lxc.install_package(step["package"])
case "remove-package": case "remove-package":