#4209 include tag name in newRepo args
Merged 2 months ago by tkopecek. Opened 6 months ago by mikem.

file modified
+3 -2
@@ -88,7 +88,7 @@ 

          return

  

      clauses = [['repo_id', 'IS', None], ['active', 'IS', True]]

-     fields = ('*', 'task_state')

+     fields = ('*', 'task_state', 'tag_name')

      waiting = RepoQueueQuery(clauses, fields=fields, opts={'order': 'priority,id'}).execute()

      logger.debug('Got %i waiting repo requests', len(waiting))

  
@@ -369,7 +369,8 @@ 

          kwargs['event'] = req['at_event']

      # otherwise any new repo will satisfy any valid min_event

  

-     args = koji.encode_args(req['tag_id'], **kwargs)

+     tagspec = {'id': req['tag_id'], 'name': req['tag_name']}

+     args = koji.encode_args(tagspec, **kwargs)

      taskopts = {'priority': 15, 'channel': 'createrepo'}

      user_id = kojihub.get_id('users', context.opts['RepoQueueUser'], strict=False)

      # TODO should we error if user doesn't exist

@@ -581,7 +581,8 @@ 

  class TestQueueTask(BaseTest):

  

      def test_queue_task(self):

-         req = {'id': 100, 'tag_id': 42, 'min_event': None, 'at_event': None, 'opts': None}

+         req = {'id': 100, 'tag_id': 42, 'tag_name': 'tag 100',

+                'min_event': None, 'at_event': None, 'opts': None}

          req['opts'] = {}

  

          repos.repo_queue_task(req)
@@ -589,7 +590,8 @@ 

          self.make_task.assert_called_once()

  

      def test_queue_task_event(self):

-         req = {'id': 100, 'tag_id': 42, 'min_event': None, 'at_event': 101010, 'opts': None}

+         req = {'id': 100, 'tag_id': 42, 'tag_name': 'tag 100',

+                'min_event': None, 'at_event': 101010, 'opts': None}

          req['opts'] = {}

  

          repos.repo_queue_task(req)

This approach works fine for 1.35 clients, but for 1.34 or before we get 'malformed task'

$ koji watch-task 14399
Watching tasks (this may be safely interrupted)...
14399 malformed task: closed
  14400 createrepo (x86_64): closed

14399 malformed task completed successfully

So probably another approach is needed

Actually, the taskLabel code has been able to handle a dict as the tag arg for a while. The 'malformed task' display is due to the signature change for the newRepo task.

The masked traceback is:

Traceback (most recent call last):
  File "/home/mikem/Devel/koji/koji/koji/__init__.py", line 3737, in taskLabel
    return _taskLabel(taskInfo)
           ^^^^^^^^^^^^^^^^^^^^
  File "/home/mikem/Devel/koji/koji/koji/__init__.py", line 3749, in _taskLabel
    params = parse_task_params(method, request)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mikem/Devel/koji/koji/koji/tasks.py", line 140, in parse_task_params
    raise koji.ParameterError("Invalid signature for %s: %s" % (method, err))
koji.ParameterError: Invalid signature for newRepo: unexpected keyword argument 'opts'

So at least this fix is not contributing to that problem.

Filed #4210 to make this a little better for future task signature changes

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

6 months ago

I agree that with #4210 it is sufficient.

rebased onto 8c72d90

6 months ago

rebased with no conflicts

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

2 months ago

Commit 7904e4e fixes this pull-request

Pull-Request has been merged by tkopecek

2 months ago