From 35c07f0384057aea1b2f071ba4c9a6e56d63853e Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Wed, 16 Nov 2022 13:01:15 -0500 Subject: [PATCH] Ensure transient dirs are cleaned up --- api-daemon/provisioner/examples/script/4-rinse.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/api-daemon/provisioner/examples/script/4-rinse.py b/api-daemon/provisioner/examples/script/4-rinse.py index 3ed35d23..4d8d9512 100644 --- a/api-daemon/provisioner/examples/script/4-rinse.py +++ b/api-daemon/provisioner/examples/script/4-rinse.py @@ -682,11 +682,6 @@ GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop= # Set the timezone to UTC os.system("ln -sf ../usr/share/zoneinfo/UTC /etc/localtime") - # Unmount the bound devfs and sysfs - os.system("umount {}/dev".format(temporary_directory)) - os.system("umount {}/sys".format(temporary_directory)) - os.system("umount {}/proc".format(temporary_directory)) - def cleanup(self): """ cleanup(): Perform any cleanup required due to prepare()/install() @@ -708,6 +703,11 @@ GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop= # Set the tempdir we used in the prepare() and install() steps temp_dir = "/tmp/target" + # Unmount the bound devfs and sysfs + os.system(f"umount {temp_dir}/dev") + os.system(f"umount {temp_dir}/sys") + os.system(f"umount {temp_dir}/proc") + # Use this construct for reversing the list, as the normal reverse() messes with the list for volume in list(reversed(self.vm_data["volumes"])): dst_volume_name = f"{self.vm_name}_{volume['disk_id']}"