trigger auto refusals in make_task

This commit is contained in:
Mike McLean 2024-03-19 16:29:36 -04:00 committed by Tomas Kopecek
parent 8894fcbca3
commit 826f8637d9
2 changed files with 7 additions and 1 deletions

View file

@ -748,6 +748,7 @@ def make_task(method, arglist, **opts):
opts['id'] = task_id
koji.plugin.run_callbacks(
'postTaskStateChange', attribute='state', old=None, new='FREE', info=opts)
scheduler.auto_arch_refuse(task_id) # temporary hack
return task_id

View file

@ -114,6 +114,10 @@ def auto_arch_refuse(task_id):
if info['method'] not in {'buildArch', 'buildMaven', 'wrapperRPM', 'rebuildSRPM',
'buildSRPMFromSCM', 'rebuildSRPM'}:
return
if task.isFinished():
# shouldn't happen
logger.warning('Skipping auto refusal for closed task %i', task_id)
return
try:
task_params = koji.tasks.parse_task_params(info['method'], info['request'])
@ -141,7 +145,8 @@ def auto_arch_refuse(task_id):
# from here, we're basically doing checkHostArch() for all hosts in the channel
tag_arches = set([koji.canonArch(a) for a in taginfo['arches'].split()])
hosts = context.handlers.call('listHosts', channelID=info['channel_id'], enabled=True)
hosts = context.handlers.call('listHosts', channelID=info['channel_id'], enabled=True,
queryOpts={'order':'id'})
for host in hosts:
host_arches = host['arches'].split()
logger.debug('%r vs %r', tag_arches, host_arches)