#2906 lib: return taskLabel for unknown tasks
Merged 11 months ago by tkopecek. Opened 11 months ago by tkopecek.
tkopecek/koji issue2904  into  master

file modified
+8 -1
@@ -3363,7 +3363,14 @@ 

      method = taskInfo['method']

      request = taskInfo['request']

      arch = taskInfo['arch']

-     params = parse_task_params(method, request)

+     try:

+         params = parse_task_params(method, request)

+     except TypeError:

+         # for external hub plugins which are not known

+         # at this place (e.g. client without knowledge of such signatures)

+         # it should still display at least "method (arch)"

+         params = None


      extra = ''

      if method in ('build', 'maven'):

          src = params.get('src') or params.get('url')

"malformed task" has been returned for everything unknown, but external
plugins can create completely valid tasks which we can't parse without
those plugins. In such case we want to return at least method/arch info.

Related: https://pagure.io/koji/issue/2904

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

11 months ago

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

11 months ago

Commit 99df706 fixes this pull-request

Pull-Request has been merged by tkopecek

11 months ago

I was using watch_tasks() with a buildContainer task, and it previously showed malformed task.

This PR fixes it.

We've to think about better interfacing of lib and hub/builder plugins. Client lib (web + cli) is simply missing info about those plugins and displays stripped info, while it could have display more.

One thing that stood out to me about this taskLabel method:

def taskLabel(taskInfo):
        return _taskLabel(taskInfo)
    except Exception:
        return "malformed task"

Catching a bare Exception always stands out to me. It would be nice to narrow the exception we're catching there. It's kind of tricky to know what exception we hit, or what the problem was.