fixed key error on optional() for creation steps

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

View File

@ -60,6 +60,9 @@ def are_all_conditions_met(lxc: LXC):
for condition_type in step["conditions"]: for condition_type in step["conditions"]:
result = check_conditions(c_type=condition_type, parent=step["conditions"], lxc=lxc, result=result) result = check_conditions(c_type=condition_type, parent=step["conditions"], lxc=lxc, result=result)
if len(result) == 0:
return False
return all(result) return all(result)
@ -152,7 +155,7 @@ def run_steps(lxc: LXC):
case "script": case "script":
lxc_utils.run_script_step_parser(lxc, step) lxc_utils.run_script_step_parser(lxc, step)
case "file_create": case "file_create":
lxc.create_file(step["path"], optional(step["permission"], 644)) lxc.create_file(step["path"], step.get("permission", 644))
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":