From 6d3d9b3fbc1fb8f912ee65bbcaae9cbd7cf6bf42 Mon Sep 17 00:00:00 2001 From: Mathieu Broillet Date: Tue, 20 Jun 2023 15:15:30 +0200 Subject: [PATCH] fixed key error on optional() for creation steps --- src/lxc/creation_utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lxc/creation_utils.py b/src/lxc/creation_utils.py index 3142fe5..73f2f41 100644 --- a/src/lxc/creation_utils.py +++ b/src/lxc/creation_utils.py @@ -60,6 +60,9 @@ def are_all_conditions_met(lxc: LXC): for condition_type in step["conditions"]: result = check_conditions(c_type=condition_type, parent=step["conditions"], lxc=lxc, result=result) + if len(result) == 0: + return False + return all(result) @@ -152,7 +155,7 @@ def run_steps(lxc: LXC): case "script": lxc_utils.run_script_step_parser(lxc, step) case "file_create": - lxc.create_file(step["path"], optional(step["permission"], 644)) + lxc.create_file(step["path"], step.get("permission", 644)) case "file_copy": lxc.pve.copy_file_to_lxc(lxc, get_path(lxc, step["path"]), step["destination"]) case "folder":