예제 #1
0
    def nonbtrfs_run_test(self, devdata_mock, storage_mock, symlink_mock,
                          rename_mock, exec_mock):
        """Test OSTree bootloader config task, no BTRFS"""
        proxy_mock = storage_mock.get_proxy()
        proxy_mock.GetArguments.return_value = ["BOOTLOADER-ARGS"]
        proxy_mock.GetFstabSpec.return_value = "FSTAB-SPEC"
        proxy_mock.GetRootDevice.return_value = "device-name"
        devdata_mock.from_structure.return_value.type = "something-non-btrfs-subvolume-ish"

        with tempfile.TemporaryDirectory() as sysroot:
            os.makedirs(sysroot + "/boot/grub2")
            os.mknod(sysroot + "/boot/grub2/grub.cfg")

            task = ConfigureBootloader(sysroot)
            task.run()

            rename_mock.assert_called_once_with(
                sysroot + "/boot/grub2/grub.cfg",
                sysroot + "/boot/loader/grub.cfg")
            symlink_mock.assert_called_once_with(
                "../loader/grub.cfg", sysroot + "/boot/grub2/grub.cfg")
            exec_mock.assert_called_once_with("ostree", [
                "admin", "instutil", "set-kargs", "BOOTLOADER-ARGS",
                "root=FSTAB-SPEC"
            ],
                                              root=sysroot)
예제 #2
0
    def post_install(self):
        super().post_install()
        data = self._get_source_configuration()

        # Following up on the "remote delete" earlier, we removed the remote from
        # /ostree/repo/config.  But we want it in /etc, so re-add it to /etc/ostree/remotes.d,
        # using the sysroot path.
        #
        # However, we ignore the case where the remote already exists, which occurs when the
        # content itself provides the remote config file.
        #
        # Note here we use the deployment as sysroot, because it's that version of /etc that we
        # want.

        from pyanaconda.modules.payloads.payload.rpm_ostree.installation import \
            ChangeOSTreeRemoteTask
        task = ChangeOSTreeRemoteTask(data,
                                      use_root=True,
                                      root=conf.target.system_root)
        task.run()

        # Handle bootloader configuration
        from pyanaconda.modules.payloads.payload.rpm_ostree.installation import \
            ConfigureBootloader
        task = ConfigureBootloader(sysroot=conf.target.system_root,
                                   is_dirinstall=conf.target.is_directory)
        task.run()
예제 #3
0
    def dir_run_test(self, conf_mock, symlink_mock, rename_mock, exec_mock):
        """Test OSTree bootloader config task, dirinstall"""
        conf_mock.target.is_directory = True

        with tempfile.TemporaryDirectory() as sysroot:
            os.makedirs(sysroot + "/boot/grub2")
            os.mknod(sysroot + "/boot/grub2/grub.cfg")

            task = ConfigureBootloader(sysroot)
            task.run()

            rename_mock.assert_called_once_with(
                sysroot + "/boot/grub2/grub.cfg",
                sysroot + "/boot/loader/grub.cfg")
            symlink_mock.assert_called_once_with(
                "../loader/grub.cfg", sysroot + "/boot/grub2/grub.cfg")
            exec_mock.assert_not_called()
예제 #4
0
    def post_install_with_tasks(self):
        """Execute post installation steps.

        :return: list of tasks
        """
        ostree_source = self._get_source(SourceType.RPM_OSTREE)

        if not ostree_source:
            log.debug("No OSTree RPM source is available.")
            return []

        return [
            ChangeOSTreeRemoteTask(data=ostree_source.configuration,
                                   sysroot=conf.target.system_root),
            ConfigureBootloader(sysroot=conf.target.system_root, )
        ]