Exemplo n.º 1
0
 def restore_rhsm_log_level_task_test(self):
     """Test the RestoreRHSMLogLevelTask task."""
     mock_config_proxy = Mock()
     task = RestoreRHSMLogLevelTask(rhsm_config_proxy=mock_config_proxy)
     task.run()
     mock_config_proxy.Set.assert_called_once_with(
         "logging.default_log_level", get_variant(Str, "INFO"), "")
Exemplo n.º 2
0
    def install_with_tasks(self):
        """Return the installation tasks of this module.

        Order of execution is important:
        - before transferring subscription tokens we need to restore
          the INFO log level in rhsm.conf or else target system will
          end up with RHSM logging in DEBUG mode
        - transfer subscription tokens
        - connect to insights, this can run only once subscription
          tokens are in place on the target system or else it would
          fail as Insights client needs the subscription tokens to
          authenticate to the Red Hat Insights online service

        :returns: list of installation tasks
        """
        return [
            RestoreRHSMLogLevelTask(
                rhsm_config_proxy=self.rhsm_observer.get_proxy(RHSM_CONFIG)),
            TransferSubscriptionTokensTask(
                sysroot=conf.target.system_root,
                transfer_subscription_tokens=self.subscription_attached),
            ConnectToInsightsTask(
                sysroot=conf.target.system_root,
                subscription_attached=self.subscription_attached,
                connect_to_insights=self.connect_to_insights)
        ]