hub: remove debugFunction API

testcase of list-api has some litaral reference. It doesn't matter but changed as well

fixes: #1833
This commit is contained in:
Yu Ming Zhu 2019-12-06 05:36:56 +00:00 committed by Tomas Kopecek
parent 1993a4f8cc
commit bce5afdf0c
4 changed files with 7 additions and 24 deletions

View file

@ -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'

View file

@ -11495,18 +11495,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)

View file

@ -436,7 +436,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'],

View file

@ -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)