예제 #1
0
    def configure_test(self):
        """Test the final configuration of the boot loader."""
        bootloader = Mock()
        storage = Mock(bootloader=bootloader)

        version = "4.17.7-200.fc28.x86_64"

        with tempfile.TemporaryDirectory() as root:
            ConfigureBootloaderTask(storage, BootloaderMode.DISABLED,
                                    [version], root).run()

        bootloader.add_image.assert_not_called()

        with tempfile.TemporaryDirectory() as root:
            ConfigureBootloaderTask(storage, BootloaderMode.ENABLED, [version],
                                    root).run()

        bootloader.add_image.assert_called_once()
        image = bootloader.add_image.call_args[0][0]

        self.assertIsInstance(image, LinuxBootLoaderImage)
        self.assertEqual(image, bootloader.default)
        self.assertEqual(image.version, version)
        self.assertEqual(image.label, "anaconda")
        self.assertEqual(image.short_label, "linux")
        self.assertEqual(image.device, storage.root_device)
예제 #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 test_configure(self):
        """Test the final configuration of the boot loader."""
        bootloader = Mock()
        storage = Mock(bootloader=bootloader)
        version = "4.17.7-200.fc28.x86_64"

        with tempfile.TemporaryDirectory() as root:
            ConfigureBootloaderTask(
                storage=storage,
                mode=BootloaderMode.ENABLED,
                payload_type=PAYLOAD_TYPE_RPM_OSTREE,
                kernel_versions=[version],
                sysroot=root
            ).run()

        bootloader.add_image.assert_not_called()

        with tempfile.TemporaryDirectory() as root:
            ConfigureBootloaderTask(
                storage=storage,
                mode=BootloaderMode.DISABLED,
                payload_type=PAYLOAD_TYPE_LIVE_IMAGE,
                kernel_versions=[version],
                sysroot=root
            ).run()

        bootloader.add_image.assert_not_called()

        with tempfile.TemporaryDirectory() as root:
            ConfigureBootloaderTask(
                storage=storage,
                mode=BootloaderMode.ENABLED,
                payload_type=PAYLOAD_TYPE_LIVE_IMAGE,
                kernel_versions=[version],
                sysroot=root
            ).run()

        bootloader.add_image.assert_called_once()
        image = bootloader.add_image.call_args[0][0]

        assert isinstance(image, LinuxBootLoaderImage)
        assert image == bootloader.default
        assert image.version == version
        assert image.label == "anaconda"
        assert image.device == storage.root_device
예제 #4
0
    def configure_with_task(self, kernel_versions):
        """Configure the bootloader.

        FIXME: This is just a temporary method.

        :param kernel_versions: a list of kernel versions
        :return: a task
        """
        return ConfigureBootloaderTask(storage=self.storage,
                                       mode=self.bootloader_mode,
                                       kernel_versions=kernel_versions,
                                       sysroot=conf.target.system_root)
예제 #5
0
    def configure_with_task(self, kernel_versions):
        """Configure the bootloader.

        FIXME: This is just a temporary method.

        :param kernel_versions: a list of kernel versions
        :return: a path to a DBus task
        """
        task = ConfigureBootloaderTask(storage=self.storage,
                                       mode=self.bootloader_mode,
                                       kernel_versions=kernel_versions,
                                       sysroot=conf.target.system_root)
        path = self.publish_task(BOOTLOADER.namespace, task)
        return path