Harden atomic rename
This commit is contained in:
parent
98840ead3b
commit
c385a100a3
2 changed files with 2 additions and 6 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue