Harden atomic rename
This commit is contained in:
parent
98840ead3b
commit
c385a100a3
2 changed files with 2 additions and 6 deletions
|
|
@ -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