Пример #1
0
    def install_test(self):
        """Test the installation task for the boot loader."""
        bootloader = Mock()
        storage = Mock(bootloader=bootloader)

        InstallBootloaderTask(storage, BootloaderMode.DISABLED).run()
        bootloader.write.assert_not_called()

        InstallBootloaderTask(storage, BootloaderMode.SKIPPED).run()
        bootloader.write.assert_not_called()

        InstallBootloaderTask(storage, BootloaderMode.ENABLED).run()
        bootloader.set_boot_args.assert_called_once()
        bootloader.write.assert_called_once()
Пример #2
0
    def install_bootloader_with_tasks(self, payload_type, kernel_versions):
        """Install the bootloader 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 [
            CreateRescueImagesTask(payload_type=payload_type,
                                   kernel_versions=kernel_versions,
                                   sysroot=conf.target.system_root),
            ConfigureBootloaderTask(storage=self.storage,
                                    mode=self.bootloader_mode,
                                    payload_type=payload_type,
                                    kernel_versions=kernel_versions,
                                    sysroot=conf.target.system_root),
            InstallBootloaderTask(storage=self.storage,
                                  mode=self.bootloader_mode),
            CreateBLSEntriesTask(storage=self.storage,
                                 payload_type=payload_type,
                                 kernel_versions=kernel_versions,
                                 sysroot=conf.target.system_root)
        ]
Пример #3
0
    def install_with_task(self):
        """Install the bootloader.

        FIXME: This is just a temporary method.

        :return: a task
        """
        return InstallBootloaderTask(storage=self.storage,
                                     mode=self.bootloader_mode)
Пример #4
0
    def install_with_task(self):
        """Install the bootloader.

        FIXME: This is just a temporary method.

        :return: a path to a DBus task
        """
        task = InstallBootloaderTask(storage=self.storage,
                                     mode=self.bootloader_mode)
        path = self.publish_task(BOOTLOADER.namespace, task)
        return path
Пример #5
0
    def install_test(self):
        """Test the installation task for the boot loader."""
        bootloader = Mock()
        storage = Mock(bootloader=bootloader)

        with tempfile.TemporaryDirectory() as root:
            InstallBootloaderTask(storage, BootloaderMode.DISABLED, root).run()

        bootloader.write.assert_not_called()

        with tempfile.TemporaryDirectory() as root:
            InstallBootloaderTask(storage, BootloaderMode.SKIPPED, root).run()

        bootloader.write.assert_not_called()

        with tempfile.TemporaryDirectory() as root:
            InstallBootloaderTask(storage, BootloaderMode.ENABLED, root).run()

        bootloader.set_boot_args.assert_called_once()
        bootloader.write.assert_called_once()
Пример #6
0
    def install_with_task(self, sysroot):
        """Install the bootloader.

        FIXME: This is just a temporary method.

        :param sysroot: a path to the root of the installed system
        :return: a path to a DBus task
        """
        task = InstallBootloaderTask(storage=self.storage,
                                     mode=self.bootloader_mode,
                                     sysroot=sysroot)
        path = self.publish_task(BOOTLOADER.namespace, task)
        return path