예제 #1
0
    def test_subman_profile_enabled_missing_config_key(self, mock_init):
        mock_config = Mock()
        mock_init.return_value = mock_config
        mock_config.get.side_effect = NoOptionError('rhsm', 'package_profile_on_trans')

        self.assertTrue(utils.plugin_enabled(ENABLED_CONF))
        mock_config.get.assert_called_with('rhsm', 'package_profile_on_trans')
예제 #2
0
    def test_subman_profile_enabled_disabled(self, mock_init):
        mock_config = Mock()
        mock_init.return_value = mock_config
        mock_config.get.return_value = '0'

        self.assertTrue(utils.plugin_enabled(ENABLED_CONF))
        mock_config.get.assert_called_with('rhsm', 'package_profile_on_trans')
예제 #3
0
def upload_package_profile(force=False):
    if not plugin_enabled(PACKAGE_PROFILE_PLUGIN_CONF, DISABLE_PACKAGE_PROFILE_VAR, force):
      return

    consumer_id = lookup_consumer_id()
    if consumer_id is None:
        sys.stderr.write("Cannot upload package profile. Is this client registered?\n")
    else:
        get_manager().profilelib._do_update()
예제 #4
0
def upload_package_profile(force=False):
    if not plugin_enabled(PACKAGE_PROFILE_PLUGIN_CONF,
                          DISABLE_PACKAGE_PROFILE_VAR, force):
        return

    consumer_id = lookup_consumer_id()
    if consumer_id is None:
        sys.stderr.write(
            "Cannot upload package profile. Is this client registered?\n")
    else:
        get_manager().profilelib._do_update()
예제 #5
0
def upload_enabled_repos_report(report, force=False):
    if not plugin_enabled(ENABLED_REPOS_PLUGIN_CONF, DISABLE_ENABLE_REPOS_VAR,
                          force):
        return

    content = report.content
    consumer_id = lookup_consumer_id()
    if consumer_id is None:
        error_message(
            'Cannot upload enabled repos report, is this client registered?')
    else:
        cache = EnabledRepoCache(consumer_id, content)
        if not cache.is_valid() and report_enabled_repos(consumer_id, content):
            cache.save()
예제 #6
0
 def test_env_disabled_force(self, mock_subman):
     os.environ['testa'] = 'true'
     self.assertTrue(utils.plugin_enabled(ENABLED_CONF, 'testa', True))
예제 #7
0
 def test_env_disabled(self, mock_subman):
     os.environ['testa'] = 'true'
     self.assertFalse(utils.plugin_enabled(ENABLED_CONF, 'testa'))
예제 #8
0
 def test_conf_disabled_force(self, mock_subman):
     self.assertTrue(utils.plugin_enabled(DISABLED_CONF, None, True))
예제 #9
0
 def test_conf_disabled(self, mock_subman):
     self.assertFalse(utils.plugin_enabled(DISABLED_CONF))
예제 #10
0
 def test_conf_enabled(self, mock_subman):
     self.assertTrue(utils.plugin_enabled(ENABLED_CONF))