#4079 www: fix for non-existent target_info
Merged a year ago by mikem. Opened 2 years ago by tkopecek.
tkopecek/koji issue4078  into  master

file modified
+4 -4
@@ -739,10 +739,10 @@ 

          params['task_list'] = tmp

      if 'wait_list' in params:

          params['wait_list'] = [server.getTaskInfo(t) for t in params['wait_list']]

-     if 'target' in params:

-         params['build_target'] = server.getBuildTarget(params.pop('target'))

-     if 'build_target' in params:

-         params['build_target'] = server.getBuildTarget(params.pop('build_target'))

+     for key in ('target', 'build_target', 'target_info'):

+         if key in params:

+             params['build_target'] = server.getBuildTarget(params.pop(key))

+             break

      if 'build_tag' in params:

          params['build_tag'] = _get_tag(params.pop('build_tag'))

      if 'task_id' in params:

Just to clarify (since cheetah doesn't give us good traces) the issue occurs inside the printValue function that is defined inside the taskinfo template. It has this stanza

  #elif $key in ('build_target', 'target_info')
<a href="buildtargetinfo?targetID=$value['id']">$value['name']</a>

This function is used to print the task parameters. The code is assuming that either of these keys will map to a dictionary. The existing code replaces 'target' and 'build_target' parameters with a sanitized built_target parameter that is a dict, however prior to this PR it did not do this for target_info even though printValue seems to expect this.

See also: PR #3455

At any rate, this fix is fine, though I think it ensures that printValue will never encounter a target_info key.

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

a year ago

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

a year ago

Commit d866841 fixes this pull-request

Pull-Request has been merged by mikem

a year ago