def _install_image(self): # Run the installation task. task = InstallFromImageTask( sysroot=conf.target.system_root, mount_point=INSTALL_TREE + "/" ) task.run()
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
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
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 _install_image(self): """Install the content of the image.""" task = InstallFromImageTask( sysroot=self._sysroot, mount_point=self._content_path ) self._run_task(task)
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" ])
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)
def install_with_tasks(self): """Install the payload with tasks.""" image_source = self._get_source(SourceType.LIVE_OS_IMAGE) if not image_source: log.debug("No Live OS image is available.") return [] task = InstallFromImageTask(sysroot=conf.target.system_root, mount_point=image_source.mount_point) task.succeeded_signal.connect( lambda: self._update_kernel_version_list(image_source)) return [task]