From c385a100a3637bddd5477a74418ef02a599c1382 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Br=C3=BCsecke?= Date: Sat, 7 Nov 2026 13:04:20 +0200 Subject: [PATCH] Harden atomic rename --- backend/disks/disk_paths.py | 4 ---- backend/disks/disk_utils.py | 4 ++-- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/backend/disks/disk_paths.py b/backend/disks/disk_paths.py index daa05ea..9e3effd 100644 --- a/backend/disks/disk_paths.py +++ b/backend/disks/disk_paths.py @@ -25,10 +25,6 @@ class DiskPaths: def nvram_target_path(self): return self.storage_host_path / self.persistence_type / self.nvram_target_filename - @property - def staging_path(self): - return self.storage_host_path / 'staging' - @property def storage_host_path(self): return self.STORAGE_HOSTS_PATH / self.storage_host diff --git a/backend/disks/disk_utils.py b/backend/disks/disk_utils.py index c2641d9..e6a054d 100644 --- a/backend/disks/disk_utils.py +++ b/backend/disks/disk_utils.py @@ -4,7 +4,7 @@ import subprocess import tempfile def create_os_disk(paths): - with tempfile.TemporaryDirectory(dir=paths.staging_path) as temporary_directory: + with tempfile.TemporaryDirectory(dir=paths.target_path.parent) as temporary_directory: temporary_path = pathlib.Path(temporary_directory) / 'disk.qcow2' subprocess.run( @@ -22,7 +22,7 @@ def create_os_disk(paths): temporary_path.replace(paths.target_path) def create_nvram_disk(paths): - with tempfile.TemporaryDirectory(dir=paths.staging_path) as temporary_directory: + with tempfile.TemporaryDirectory(dir=paths.nvram_target_path.parent) as temporary_directory: temporary_path = pathlib.Path(temporary_directory) / 'NVRAM.img' shutil.copyfile(paths.nvram_path, temporary_path)