#4043 --limit from scheduler-logs/info
Merged by tkopecek. Opened by tkopecek.
tkopecek/koji issue4042  into  master

Download 4043.patch

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

  • fixing the header for scheduler-logs

~~ thumbsup ~~

Well, the client should avoid passing the new opts parameter if it can and/or fall back. The 1.34.1 client should not error so easily talking to a 1.34.0 hub

updated

1 new commit added

  • backward compatibility
runs = None
if options.limit is not None:
    try:
        runs = session.scheduler.getTaskRuns(
        ...
    except koji.GenericError:
        # iterator is sufficient here as we don't modify the list
        runs = reversed(runs)
if runs is None:
    # hub could be 1.34.0 without opts support or user doesn't use --limit

We should be more discerning about the error before assuming it was caused by the opts parameter. Any hub that supports the call is going to return ParameterError for incorrect params. A pre-1.34 hub will return GenericError: Invalid method.

The runs = reversed(runs) in the except handler is going to error because runs will still be None. Perhaps this reversal belongs elsewhere?

1 new commit added

  • better compatibility errors

updated

It's unfortunately tedious to handle this compat with trial and error. I note that we still get the raw invalid method error with the limit arg.

I wonder if it would be better to handle the compat with a hub version check since we have that data so much more readily now. Maybe something like:

https://pagure.io/fork/mikem/koji/commits/pr4043updates

The downside, in the short term at least, is that the cli will still use the compat code until we actually bump the release

2 new commits added

  • modify for 1.34.1
  • use hub version check for compat code

I think we can add it to 1.34.1, so it is not waiting too long? It doesn't modify any old behaviour, just adds new.

Yeah, should be fine for 1.34.1

:thumbsup:

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

scheduler-logs --limit 2 fails with:

[ERROR] koji: TypeError: 'NoneType' object is not iterable

list.reverse() works in place, so this line sets logs variable as empty and fails on traversal afterwards.

rebased onto 43b173bb17b5fb2044cf12cf4af25383253fa642

6 new commits added

  • fix typo
  • modify for 1.34.1
  • use hub version check for compat code
  • better compatibility errors
  • backward compatibility
  • --limit from scheduler-logs/info

Why does this last commit include so much churn?

commit f30d04519b30d54581d09a08084ea3ec1db31e9e (HEAD -> pagure/pr/4043)
Author: Tomas Kopecek <tkopecek@redhat.com>
Date:   Wed Mar 20 13:48:49 2024 +0100
    fix typo
 cli/koji_cli/commands.py | 5617 +++++++++++++++++++++++++++++++++++++++++++-----------------------------
 1 file changed, 3362 insertions(+), 2255 deletions(-)

fixed now - it was a mistake, that it was autoformatted during commit.

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

1 new commit added

  • fix flake8

Commit 41ab495f fixes this pull-request

Pull-Request has been merged by tkopecek

Metadata