#2387 cli: list-tags: fall back to old behavior on ParameterError
Merged 2 years ago by mikem. Opened 2 years ago by mikem.

file modified
+20 -8
@@ -4116,15 +4116,27 @@ 

  

      if not args:

          # list everything if no pattern is supplied

-         args = [None]

+         tags = session.listTags(build=buildinfo.get('id', None),

+                                 package=pkginfo.get('id', None))

+     else:

+         # The hub may not support the pattern option. We try with that first

+         # and fall back to the old way.

+         fallback = False

+         try:

+             tags = []

+             with session.multicall(strict=True) as m:

+                 for arg in args:

+                     tags.append(m.listTags(build=buildinfo.get('id', None),

+                                            package=pkginfo.get('id', None),

+                                            pattern=arg))

+             tags = list(itertools.chain(*[t.result for t in tags]))

+         except koji.ParameterError:

+             fallback = True

+         if fallback:

+             # without the pattern option, we have to filter client side

+             tags = session.listTags(buildinfo.get('id', None), pkginfo.get('id', None))

+             tags = [t for t in tags if koji.util.multi_fnmatch(t['name'], args)]

  

-     tags = []

-     with session.multicall() as m:

-         for arg in args:

-             tags.append(m.listTags(build=buildinfo.get('id', None),

-                                    package=pkginfo.get('id', None),

-                                    pattern=arg))

-     tags = list(itertools.chain(*[t.result for t in tags]))

      tags.sort(key=lambda x: x['name'])

      # if options.verbose:

      #    fmt = "%(name)s [%(id)i] %(perm)s %(locked)s %(arches)s"

Fixes https://pagure.io/koji/issue/2379

This is an alternative to #2380 which implements the third option from #2379

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

2 years ago

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

2 years ago

pretty please pagure-ci rebuild

2 years ago

pretty please pagure-ci rebuild

2 years ago

1 new commit added

  • whitespace to make flake8 happy
2 years ago

Commit 2d27453 fixes this pull-request

Pull-Request has been merged by mikem

2 years ago