Hmm, if you're calling it from inside hub, you need to replicate what
distRepo API call [1] does. Your code is failing, because you don't send
all required parameters make_task('distRepo', [tag, repo_id, keys, opts],
**taskOpts).
Second option - safer, would be to use API directly (if you don't care
about task owner rewrite, or arch pinning (taskOpts)). so
api = kojihub.RootExports()
api.distRepo(tag, keys, **opts)
[1]
https://pagure.io/koji/blob/master/f/hub/kojihub.py#10580
čt 25. 4. 2019 v 0:36 odesílatel Robert Callicotte <rcallicotte(a)gmail.com>
napsal:
Hello,
I am using koji version 1.16.2 for centos 7 and I'm having issues getting
the following code to succeed:
################################################
import sys
import logging
import koji
from koji.plugin import callback
koji_hub_path = '/usr/share/koji-hub'
sys.path.insert(0, koji_hub_path)
import kojihub
logger = logging.getLogger('koji.plugins')
@callback('postTag')
def mycallback(cbtype, *args, **kwargs):
# Get the tag name from the buildroot map
opts = {}
taskOpts = {}
tag = kwargs['tag']['name']
keys = None
repo_id = 3
taskOpts['priority'] = koji.PRIO_DEFAULT
taskOpts['channel'] = 'createrepo'
taskOpts['owner'] = 3 #This is the kojiadmin account
taskOpts['arch'] = 'x86_64'
opts['tag'] = tag
opts['keys'] = keys
opts['allow_missing_signatures'] = True
opts['skip_missing_signatures'] = True
opts['latest'] = True
if tag == 'local7':
logging.getLogger('koji.plugin.mycallback').error('Executing
mycallback.')
print 'Variable dump: ', args
print 'Expected tag is local7. mytag is: ', tag
print 'Starting dist repo generator for %s...' % tag
return kojihub.make_task('distRepo', [tag, keys], **taskOpts)
The above code always fails with the following exception:
koji.hub: Cannot parse parameters: ['local7', None] of distRepo task
Is make_task the correct function to call in this instance? What should
the arguments passed to make_task look like?
Regards,
Robby
_______________________________________________
buildsys mailing list -- buildsys(a)lists.fedoraproject.org
To unsubscribe send an email to buildsys-leave(a)lists.fedoraproject.org
Fedora Code of Conduct:
https://getfedora.org/code-of-conduct.html
List Guidelines:
https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives:
https://lists.fedoraproject.org/archives/list/buildsys@lists.fedoraprojec...
--
Tomas Kopecek <tkopecek(a)redhat.com>
Release Engineering Development, RedHat