Esempio n. 1
0
    def unsetup(self):
        """Invalidate a previously setup payload."""
        from pyanaconda.modules.payloads.payload.rpm_ostree.installation import \
            TearDownOSTreeMountTargetsTask
        task = TearDownOSTreeMountTargetsTask(
            mount_points=self._internal_mounts)
        task.run()

        tear_down_sources(self.proxy)
Esempio n. 2
0
    def umount_failure_test(self, umount_mock):
        """Test a task for tearing down OSTree mount targets with a failure."""
        umount_mock.side_effect = OSError("Fake!")

        task = TearDownOSTreeMountTargetsTask([
            "/sysroot/usr",
        ])

        with self.assertLogs(level="DEBUG") as cm:
            task.run()

        msg = "Unmounting /sysroot/usr has failed: Fake!"
        self.assertTrue(any(map(lambda x: msg in x, cm.output)))
Esempio n. 3
0
    def umount_all_test(self, umount_mock):
        """Test the task for tearing down OSTree mount targets."""
        task = TearDownOSTreeMountTargetsTask([
            "/sysroot/usr",
            "/sysroot/dev",
            "/sysroot/proc",
            "/sysroot/run",
        ])
        task.run()

        umount_mock.assert_has_calls([
            call("/sysroot/run"),
            call("/sysroot/proc"),
            call("/sysroot/dev"),
            call("/sysroot/usr"),
        ])
Esempio n. 4
0
    def tear_down_with_tasks(self):
        """Returns teardown tasks for this payload.

        Clean up everything after this payload.

        :return: a list of tasks
        """
        tasks = super().tear_down_with_tasks()

        tasks.append(
            TearDownOSTreeMountTargetsTask(mount_points=self._internal_mounts))

        return tasks
Esempio n. 5
0
    def umount_none_test(self, umount_mock):
        """Test the task for tearing down OSTree mount targets with no mount points."""
        task = TearDownOSTreeMountTargetsTask([])
        task.run()

        umount_mock.assert_not_called()