Esempio n. 1
0
    def fix_btrfs_test(self, configure, install, conf):
        """Test the final configuration of the boot loader."""
        storage = create_storage()
        sysroot = "/tmp/sysroot"
        version = "4.17.7-200.fc28.x86_64"

        conf.target.is_directory = True
        FixBTRFSBootloaderTask(storage, BootloaderMode.ENABLED, [version],
                               sysroot).run()
        configure.assert_not_called()
        install.assert_not_called()

        conf.target.is_directory = False
        FixBTRFSBootloaderTask(storage, BootloaderMode.DISABLED, [version],
                               sysroot).run()
        configure.assert_not_called()
        install.assert_not_called()

        conf.target.is_directory = False
        FixBTRFSBootloaderTask(storage, BootloaderMode.ENABLED, [version],
                               sysroot).run()
        configure.assert_not_called()
        install.assert_not_called()

        dev1 = DiskDevice("dev1",
                          fmt=get_format("disklabel"),
                          size=Size("10 GiB"))
        storage.devicetree._add_device(dev1)

        dev2 = BTRFSDevice("dev2",
                           fmt=get_format("btrfs", mountpoint="/"),
                           size=Size("5 GiB"),
                           parents=[dev1])
        storage.devicetree._add_device(dev2)

        # Make the btrfs format mountable.
        dev2.format._mount = Mock(available=True)

        conf.target.is_directory = False
        FixBTRFSBootloaderTask(storage, BootloaderMode.ENABLED, [version],
                               sysroot).run()
        configure.assert_called_once_with(storage, BootloaderMode.ENABLED,
                                          [version], sysroot)
        install.assert_called_once_with(storage, BootloaderMode.ENABLED)
Esempio n. 2
0
    def fix_btrfs_with_task(self, kernel_versions):
        """Fix the bootloader on BTRFS.

        FIXME: This is just a temporary method.

        :param kernel_versions: a list of kernel versions
        :return: a task
        """
        return FixBTRFSBootloaderTask(storage=self.storage,
                                      mode=self.bootloader_mode,
                                      kernel_versions=kernel_versions,
                                      sysroot=conf.target.system_root)
Esempio n. 3
0
    def generate_initramfs_with_tasks(self, payload_type, kernel_versions):
        """Generate initramfs with a list of tasks.

        FIXME: This is just a temporary method.

        :param payload_type: a string with the payload type
        :param kernel_versions: a list of kernel versions
        :return: a list of tasks
        """
        return [
            RecreateInitrdsTask(payload_type=payload_type,
                                kernel_versions=kernel_versions,
                                sysroot=conf.target.system_root),
            FixBTRFSBootloaderTask(storage=self.storage,
                                   mode=self.bootloader_mode,
                                   payload_type=payload_type,
                                   kernel_versions=kernel_versions,
                                   sysroot=conf.target.system_root),
        ]