示例#1
0
 def org_keys_sufficient_direct_request_test(self):
     """Test the org_keys_sufficient() helper method - direct request."""
     # run the function with sufficient authentication data
     request = SubscriptionRequest.from_structure(self.KEY_REQUEST)
     self.assertTrue(org_keys_sufficient(subscription_request=request))
     # run the function with insufficient authentication data
     request = SubscriptionRequest.from_structure(self.KEY_MISSING_REQUEST)
     self.assertFalse(org_keys_sufficient(subscription_request=request))
示例#2
0
 def org_keys_sufficient_not_sufficient_test(self, get_proxy):
     """Test the org_keys_sufficient() helper method - not sufficient."""
     subscription_proxy = get_proxy.return_value
     # simulate subscription request
     subscription_proxy.SubscriptionRequest = self.KEY_MISSING_REQUEST
     # run the function
     self.assertFalse(org_keys_sufficient())
示例#3
0
    def _update_register_button_state(self):
        """Update register button state.

        The button is only sensitive if no processing is ongoing
        and we either have enough authentication data to register
        or the system is subscribed, so we can unregister it.
        """
        button_sensitive = False
        if self._registration_controls_enabled:
            # if we are subscribed, we can always unregister
            if self.subscription_attached:
                button_sensitive = True
            # check if credentials are sufficient for registration
            elif self.authentication_method == AuthenticationMethod.USERNAME_PASSWORD:
                button_sensitive = username_password_sufficient(self.subscription_request)
            elif self.authentication_method == AuthenticationMethod.ORG_KEY:
                button_sensitive = org_keys_sufficient(self.subscription_request)
        self._register_button.set_sensitive(button_sensitive)
示例#4
0
    atexit.register(exitHandler, ksdata.reboot)

    from pyanaconda import exception
    anaconda.mehConfig = exception.initExceptionHandling(anaconda)

    # Start the subscription handling thread if the Subscription DBus module
    # provides enough authentication data.
    # - as kickstart only supports org + key authentication & nothing
    #   else currently talks to the Subscription DBus module,
    #   we only check if organization id & at least one activation
    #   key are available
    from pyanaconda.modules.common.util import is_module_available
    from pyanaconda.modules.common.constants.services import SUBSCRIPTION
    if is_module_available(SUBSCRIPTION):
        from pyanaconda.ui.lib.subscription import org_keys_sufficient, register_and_subscribe
        if org_keys_sufficient():
            threadMgr.add(
                AnacondaThread(
                    name=constants.THREAD_SUBSCRIPTION,
                    target=register_and_subscribe,
                    args=[anaconda.payload]
                )
            )

    # add additional repositories from the cmdline to kickstart data
    anaconda.add_additional_repositories_to_ksdata()

    # Fallback to default for interactive or for a kickstart with no installation method.
    fallback = not flags.automatedInstall \
        or anaconda.payload.source_type == conf.payload.default_source