Fix bugs when main installs fail

This commit is contained in:
Joshua Boniface 2023-11-16 18:19:20 -05:00
parent 823ce8cbf2
commit 815041ff20
2 changed files with 7 additions and 2 deletions

View File

@ -495,9 +495,11 @@ class VMBuilderScript(VMBuilder):
self.log_info( self.log_info(
f"Installing system with debootstrap: debootstrap --include={','.join(deb_packages)} {deb_release} {temp_dir} {deb_mirror}" f"Installing system with debootstrap: debootstrap --include={','.join(deb_packages)} {deb_release} {temp_dir} {deb_mirror}"
) )
os.system( ret = os.system(
f"debootstrap --include={','.join(deb_packages)} {deb_release} {temp_dir} {deb_mirror}" f"debootstrap --include={','.join(deb_packages)} {deb_release} {temp_dir} {deb_mirror}"
) )
if ret > 0:
self.fail("Failed to run debootstrap")
# Bind mount the devfs so we can grub-install later # Bind mount the devfs so we can grub-install later
os.system("mount --bind /dev {}/dev".format(temp_dir)) os.system("mount --bind /dev {}/dev".format(temp_dir))
@ -733,6 +735,7 @@ GRUB_DISABLE_LINUX_UUID=false
dst_volume = f"{volume['pool']}/{dst_volume_name}" dst_volume = f"{volume['pool']}/{dst_volume_name}"
mapped_dst_volume = f"/dev/rbd/{dst_volume}" mapped_dst_volume = f"/dev/rbd/{dst_volume}"
mount_path = f"{temp_dir}/{volume['mountpoint']}" mount_path = f"{temp_dir}/{volume['mountpoint']}"
self.log_info(f"Unmounting {dst_volume} from {mount_path}")
if ( if (
volume.get("source_volume") is None volume.get("source_volume") is None

View File

@ -521,9 +521,11 @@ class VMBuilderScript(VMBuilder):
self.log_info( self.log_info(
f"Installing system with rinse: rinse --arch {rinse_architecture} --directory {temporary_directory} --distribution {rinse_release} --cache-dir {rinse_cache} --add-pkg-list /tmp/addpkg --verbose {mirror_arg}" f"Installing system with rinse: rinse --arch {rinse_architecture} --directory {temporary_directory} --distribution {rinse_release} --cache-dir {rinse_cache} --add-pkg-list /tmp/addpkg --verbose {mirror_arg}"
) )
os.system( ret = os.system(
f"rinse --arch {rinse_architecture} --directory {temporary_directory} --distribution {rinse_release} --cache-dir {rinse_cache} --add-pkg-list /tmp/addpkg --verbose {mirror_arg}" f"rinse --arch {rinse_architecture} --directory {temporary_directory} --distribution {rinse_release} --cache-dir {rinse_cache} --add-pkg-list /tmp/addpkg --verbose {mirror_arg}"
) )
if ret > 0:
self.fail("Failed to run rinse")
# Bind mount the devfs, sysfs, and procfs so we can grub-install later # Bind mount the devfs, sysfs, and procfs so we can grub-install later
os.system("mount --bind /dev {}/dev".format(temporary_directory)) os.system("mount --bind /dev {}/dev".format(temporary_directory))