Пример #1
0
    def check_selection_test(self, kernel_getter):
        kernel_getter.return_value = None
        dnf_manager = Mock()

        selection = PackagesSelectionData()
        selection.core_group_enabled = False
        selection.environment = "e1"

        selection.packages = ["p1", "p2"]
        selection.excluded_packages = ["p3", "p4"]

        selection.groups = ["g1", "g2"]
        selection.excluded_groups = ["g3", "g4"]

        selection.modules = ["m1", "m2"]
        selection.disabled_modules = ["m3", "m4"]

        task = CheckPackagesSelectionTask(dnf_manager, selection)
        report = task.run()

        dnf_manager.clear_selection.assert_called_once_with()
        dnf_manager.disable_modules.assert_called_once_with(["m3", "m4"])
        dnf_manager.enable_modules.assert_called_once_with(["m1", "m2"])
        dnf_manager.apply_specs.assert_called_once_with(
            ["@e1", "@g1", "@g2", "p1", "p2"],
            ["@core", "@g3", "@g4", "p3", "p4"])
        dnf_manager.resolve_selection.assert_called_once_with()
        self.assertEqual(report.get_messages(), [])
Пример #2
0
    def check_invalid_selection_test(self, kernel_getter):
        kernel_getter.return_value = None
        selection = PackagesSelectionData()

        dnf_manager = Mock()
        dnf_manager.disable_modules.side_effect = MissingSpecsError("e1")
        dnf_manager.enable_modules.side_effect = BrokenSpecsError("e2")
        dnf_manager.apply_specs.side_effect = MissingSpecsError("e3")
        dnf_manager.resolve_selection.side_effect = InvalidSelectionError("e4")

        task = CheckPackagesSelectionTask(dnf_manager, selection)
        report = task.run()

        self.assertEqual(report.error_messages, ["e2", "e4"])
        self.assertEqual(report.warning_messages, ["e1", "e3"])
Пример #3
0
    def check_no_selection_test(self, kernel_getter):
        kernel_getter.return_value = None

        dnf_manager = Mock()
        dnf_manager.default_environment = None

        selection = PackagesSelectionData()
        selection.default_environment_enabled = False
        selection.core_group_enabled = False

        task = CheckPackagesSelectionTask(dnf_manager, selection)
        report = task.run()

        dnf_manager.clear_selection.assert_called_once_with()
        dnf_manager.disable_modules.assert_called_once_with([])
        dnf_manager.enable_modules.assert_called_once_with([])
        dnf_manager.apply_specs.assert_called_once_with([], ["@core"])
        dnf_manager.resolve_selection.assert_called_once_with()
        self.assertEqual(report.get_messages(), [])
Пример #4
0
    def test_check_default_selection(self, kernel_getter):
        kernel_getter.return_value = "kernel"

        dnf_manager = Mock()
        dnf_manager.default_environment = "environment"

        selection = PackagesSelectionData()
        selection.default_environment_enabled = True
        selection.core_group_enabled = True

        task = CheckPackagesSelectionTask(dnf_manager, selection)
        report = task.run()

        dnf_manager.clear_selection.assert_called_once_with()
        dnf_manager.disable_modules.assert_called_once_with([])
        dnf_manager.enable_modules.assert_called_once_with([])
        dnf_manager.apply_specs.assert_called_once_with(
            ["@environment", "@core", "kernel"], [])
        dnf_manager.resolve_selection.assert_called_once_with()
        self.assertEqual(report.get_messages(), [])
Пример #5
0
    def _check_software_selection(self):
        """Check the software selection."""
        self.payload.bump_tx_id()

        # Run the validation task.
        from pyanaconda.modules.payloads.payload.dnf.validation import CheckPackagesSelectionTask

        task = CheckPackagesSelectionTask(
            dnf_manager=self._dnf_manager,
            selection=self._selection,
        )

        # Get the validation report.
        report = task.run()

        self._errors = list(report.error_messages)
        self._warnings = list(report.warning_messages)
        self._tx_id = self.payload.tx_id

        print("\n".join(report.get_messages()))
Пример #6
0
    def _check_software_selection(self):
        hubQ.send_message(self.__class__.__name__, _("Checking software dependencies..."))
        self.payload.bump_tx_id()

        # Run the validation task.
        from pyanaconda.modules.payloads.payload.dnf.validation import CheckPackagesSelectionTask

        task = CheckPackagesSelectionTask(
            dnf_manager=self._dnf_manager,
            selection=self._selection,
        )

        # Get the validation report.
        report = task.run()

        log.debug("The selection has been checked: %s", report)
        self._errors = list(report.error_messages)
        self._warnings = list(report.warning_messages)
        self._tx_id = self.payload.tx_id

        hubQ.send_ready(self.__class__.__name__)
        hubQ.send_ready("SourceSpoke")