From 4717f84918aa27b5746c87498e63ea00760f8394 Mon Sep 17 00:00:00 2001 From: Yu Ming Zhu Date: Dec 06 2019 05:37:02 +0000 Subject: hub: remove debugFunction API testcase of list-api has some litaral reference. It doesn't matter but changed as well fixes: #1833 --- diff --git a/hub/hub.conf b/hub/hub.conf index a538595..8b14bc2 100644 --- a/hub/hub.conf +++ b/hub/hub.conf @@ -97,10 +97,6 @@ NotifyOnSuccess = True ## subclasses of koji.GenericError). # KojiDebug = On # -## You can call any function in hub (not only API). This is -## dangerous and should be never enabled in production. -# EnableFunctionDebug = False -# ## Log level/format for python logging module at hub # LogLevel = WARNING # LogFormat = %(asctime)s [%(levelname)s] m=%(method)s u=%(user_name)s p=%(process)s r=%(remoteaddr)s %(name)s: %(message)s' diff --git a/hub/kojihub.py b/hub/kojihub.py index a3507ba..870c886 100644 --- a/hub/kojihub.py +++ b/hub/kojihub.py @@ -11462,18 +11462,6 @@ class RootExports(object): context.session.assertPerm('repo') repo_problem(repo_id) - def debugFunction(self, name, *args, **kwargs): - # This is potentially dangerous, so it must be explicitly enabled - allowed = context.opts.get('EnableFunctionDebug', False) - if not allowed: - raise koji.ActionNotAllowed('This call is not enabled') - context.session.assertPerm('admin') - func = globals().get(name) - if callable(func): - return func(*args, **kwargs) - else: - raise koji.GenericError('Unable to find function: %s' % name) - tagChangedSinceEvent = staticmethod(tag_changed_since_event) createBuildTarget = staticmethod(create_build_target) editBuildTarget = staticmethod(edit_build_target) diff --git a/hub/kojixmlrpc.py b/hub/kojixmlrpc.py index d59b9c9..a3a9384 100644 --- a/hub/kojixmlrpc.py +++ b/hub/kojixmlrpc.py @@ -435,7 +435,6 @@ def load_config(environ): ['KojiDebug', 'boolean', False], ['KojiTraceback', 'string', None], ['VerbosePolicy', 'boolean', False], - ['EnableFunctionDebug', 'boolean', False], ['LogLevel', 'string', 'WARNING'], ['LogFormat', 'string', '%(asctime)s [%(levelname)s] m=%(method)s u=%(user_name)s p=%(process)s r=%(remoteaddr)s %(name)s: %(message)s'], diff --git a/tests/test_cli/test_list_api.py b/tests/test_cli/test_list_api.py index 1d923c4..48dfee9 100644 --- a/tests/test_cli/test_list_api.py +++ b/tests/test_cli/test_list_api.py @@ -46,11 +46,11 @@ class TestListApi(utils.CliTestCase): # Case 2. session._listapi.return_value = [ { - 'argdesc': '(name, *args, **kwargs)', - 'doc': 'A debug function', - 'argspec': [['name'], 'args', 'kwargs', None], - 'args': ['name'], - 'name': 'debugFunction' + 'argdesc': '(tagInfo, **kwargs)', + 'doc': 'Edit information for an existing tag.', + 'argspec': [['tagInfo'], None, 'kwargs', None], + 'args': ['tagInfo'], + 'name': 'editTag2' }, { 'doc': 'Add user to group', @@ -67,8 +67,8 @@ class TestListApi(utils.CliTestCase): ] expected = "addGroupMember(group, user, strict=True)\n" expected += " description: Add user to group\n" - expected += "debugFunction(name, *args, **kwargs)\n" - expected += " description: A debug function\n" + expected += "editTag2(tagInfo, **kwargs)\n" + expected += " description: Edit information for an existing tag.\n" expected += "host.getID()\n" anon_handle_list_api(options, session, []) self.assert_console_message(stdout, expected)