Beispiel #1
0
 def _install_image(self):
     # Run the installation task.
     task = InstallFromImageTask(
         sysroot=conf.target.system_root,
         mount_point=INSTALL_TREE + "/"
     )
     task.run()
Beispiel #2
0
    def test_install_image_task_failed_return_code(self, exec_with_redirect):
        """Test installation from an image task with bad return code."""
        exec_with_redirect.return_value = 11
        task = InstallFromImageTask(sysroot="/mnt/root",
                                    mount_point="/mnt/source")

        with pytest.raises(PayloadInstallationError) as cm:
            task.run()

        msg = "Failed to install image: rsync exited with code 11"
        assert str(cm.value) == msg
Beispiel #3
0
    def test_install_image_task_failed_exception(self, exec_with_redirect):
        """Test installation from an image task with exception."""
        exec_with_redirect.side_effect = OSError("Fake!")
        task = InstallFromImageTask(sysroot="/mnt/root",
                                    mount_point="/mnt/source")

        with pytest.raises(PayloadInstallationError) as cm:
            task.run()

        msg = "Failed to install image: Fake!"
        assert str(cm.value) == msg
Beispiel #4
0
    def test_install_image_task(self, exec_with_redirect):
        """Test installation from an image task."""
        exec_with_redirect.return_value = 0
        task = InstallFromImageTask(sysroot="/mnt/root",
                                    mount_point="/mnt/source")
        task.run()

        exec_with_redirect.assert_called_once_with("rsync", [
            "-pogAXtlHrDx", "--exclude", "/dev/", "--exclude", "/proc/",
            "--exclude", "/tmp/*", "--exclude", "/sys/", "--exclude", "/run/",
            "--exclude", "/boot/*rescue*", "--exclude", "/boot/loader/",
            "--exclude", "/boot/efi/loader/", "--exclude", "/etc/machine-id",
            "/mnt/source", "/mnt/root"
        ])
    def test_install_image_task(self, exec_with_redirect, os_sync):
        """Test installation from an image task."""
        exec_with_redirect.return_value = 0

        with tempfile.TemporaryDirectory() as mount_point:
            task = InstallFromImageTask(sysroot="/mnt/root",
                                        mount_point=mount_point)
            task.run()

        exec_with_redirect.assert_called_once_with("rsync", [
            "-pogAXtlHrDx", "--stats", "--exclude", "/dev/", "--exclude",
            "/proc/", "--exclude", "/tmp/*", "--exclude", "/sys/", "--exclude",
            "/run/", "--exclude", "/boot/*rescue*", "--exclude",
            "/boot/loader/", "--exclude", "/boot/efi/loader/", "--exclude",
            "/etc/machine-id", "--exclude", "/etc/machine-info",
            mount_point + "/", "/mnt/root"
        ])
Beispiel #6
0
    def install(self):
        """ Install the payload. """

        if self.source_size <= 0:
            raise PayloadInstallError("Nothing to install")

        self.pct_lock = Lock()
        self.pct = 0
        threadMgr.add(AnacondaThread(name=THREAD_LIVE_PROGRESS,
                                     target=self.progress))

        # Run the installation task.
        task = InstallFromImageTask(
            sysroot=conf.target.system_root,
            mount_point=INSTALL_TREE + "/"
        )
        task.run()

        # Wait for progress thread to finish
        with self.pct_lock:
            self.pct = 100
        threadMgr.wait(THREAD_LIVE_PROGRESS)