#1863 hub: remove debugFunction API
Merged 4 years ago by tkopecek. Opened 4 years ago by julian8628.
julian8628/koji issue/1833  into  master

file modified
-4
@@ -97,10 +97,6 @@ 

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

file modified
-12
@@ -11462,18 +11462,6 @@ 

          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)

file modified
-1
@@ -435,7 +435,6 @@ 

          ['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'],

@@ -46,11 +46,11 @@ 

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

          ]

          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)

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

fixes: #1833

Metadata Update from @tkopecek:
- Pull-request tagged with: testing-ready

4 years ago

Metadata Update from @jcupova:
- Pull-request tagged with: testing-done

4 years ago

Commit f617ea7 fixes this pull-request

Pull-Request has been merged by tkopecek

4 years ago