#1476 Allow taginfo cli to use tag IDs; fixed Inheritance printing bug
Merged by mikem. Opened by jmolet.
jmolet/koji taginfo-with-id  into  master

Download 1476.patch

It would be useful to be able to use the koji cli's taginfo with tag IDs and not just the tag name since the python library allows for this. Also there is a bug where Inheritance always uses the value of the last tag queried for.

Old behavior (ID bug):

❯❯❯ koji taginfo 6438
No such tag: 6438

Old behavior (Inheritance bug):

❯❯❯ koji taginfo rawhide f31 
Tag: rawhide [197]
Arches: aarch64 armv7hl i686 ppc64 ppc64le s390x x86_64
Groups: appliance-build, build, livecd-build, livemedia-build, srpm-build
LOCKED
Tag options:
Inheritance:
                                      <<<<< inheritance missing/incorrect
Tag: f31 [6438]
Arches: None
Groups: appliance-build, build, livecd-build, livemedia-build, srpm-build
Required permission: 'autosign'
Tag options:
  mock.new_chroot : 0
  mock.package_manager : 'dnf'
Inheritance:

New behavior:

❯❯❯ koji taginfo rawhide 6438        
Tag: rawhide [197]
Arches: aarch64 armv7hl i686 ppc64 ppc64le s390x x86_64
Groups: appliance-build, build, livecd-build, livemedia-build, srpm-build
LOCKED
Tag options:
Inheritance:
  0    .... f31 [6438]
Tag: f31 [6438]
Arches: None
Groups: appliance-build, build, livecd-build, livemedia-build, srpm-build
Required permission: 'autosign'
Tag options:
  mock.new_chroot : 0
  mock.package_manager : 'dnf'
Inheritance:

While it would be highly dubious to create a tag whose name is a valid integer, it is possible. In such a case, this would make it difficult to get info about said tag.

Perhaps it would make sense to only check for an integer if session.getTag fails for the string value.

rebased onto 1abce11fef2dc4cdd4e6d8ee9e3626cca1d0d931

@mikem Good thought. I've updated this with those changes.

Maybe less lines with

    except ValueError:
        info = None`
    if info is None:
        print("No such tag: %s" % tag)
        sys.exit(1)

block only once?

rebased onto d87cdc46bed187e6bfc00c64d8b2516c05375be3

@tkopecek Much cleaner! Added.

:thumbsup:

Thanks!

I've filed an issue for the inheritance display issue just for tracking purposes.

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

Commit 6c0c45d5 fixes this pull-request

Pull-Request has been merged by mikem

Metadata