Example #1
0
 def check_cdn_is_installation_source_test(self):
     """Test the check_cdn_is_installation_source function."""
     # check CDN is reported as used
     dnf_payload = Mock()
     dnf_payload.type = PAYLOAD_TYPE_DNF
     source_proxy = dnf_payload.get_source_proxy.return_value
     source_proxy.Type = SOURCE_TYPE_CDN
     self.assertTrue(check_cdn_is_installation_source(dnf_payload))
     # check CDN is not reported as used
     dnf_payload = Mock()
     dnf_payload.type = PAYLOAD_TYPE_DNF
     source_proxy = dnf_payload.get_source_proxy.return_value
     source_proxy.Type = SOURCE_TYPE_CDROM
     self.assertFalse(check_cdn_is_installation_source(dnf_payload))
     # check an unsupported (non DNF) source is handled correctly
     ostree_payload = Mock()
     ostree_payload.type = PAYLOAD_TYPE_RPM_OSTREE
     self.assertFalse(check_cdn_is_installation_source(ostree_payload))
Example #2
0
    def status(self):
        if self._error_msgs:
            return _("Error checking software selection")

        cdn_source = check_cdn_is_installation_source(self.payload)

        subscribed = False
        if is_module_available(SUBSCRIPTION):
            subscription_proxy = SUBSCRIPTION.get_proxy()
            subscribed = subscription_proxy.IsSubscriptionAttached

        if cdn_source and not subscribed:
            return _("Red Hat CDN requires registration.")

        if not self.ready:
            return _("Installation source not set up")

        if not self.txid_valid:
            return _("Source changed - please verify")

        # kickstart installation
        if flags.automatedInstall:
            if self._kickstarted:
                # %packages section is present in kickstart but environment is not set
                if not self._selection.environment:
                    return _("Custom software selected")
                # environment is set to an invalid value
                elif not self.is_environment_valid(
                        self._selection.environment):
                    return _("Invalid environment specified in kickstart")
            # we have no packages section in the kickstart and no environment has been set
            elif not self._selection.environment:
                return _("Please confirm software selection")

        if not flags.automatedInstall:
            if not self._selection.environment:
                # No environment yet set
                return _("Please confirm software selection")
            elif not self.is_environment_valid(self._selection.environment):
                # selected environment is not valid, this can happen when a valid environment
                # is selected (by default, manually or from kickstart) and then the installation
                # source is switched to one where the selected environment is no longer valid
                return _("Selected environment is not valid")

        return self.payload.environment_description(
            self._selection.environment)[0]
Example #3
0
 def mandatory(self):
     """The subscription spoke is mandatory if Red Hat CDN is set as installation source."""
     return check_cdn_is_installation_source(self.payload)