handle refusal with an exception
This commit is contained in:
parent
4b35b7b729
commit
4a31c42edd
3 changed files with 12 additions and 3 deletions
|
|
@ -1504,6 +1504,9 @@ class TaskManager(object):
|
|||
except (SystemExit, koji.tasks.ServerExit, KeyboardInterrupt):
|
||||
# we do not trap these
|
||||
raise
|
||||
except koji.tasks.RefuseTask as refuse:
|
||||
self.session.host.refuseTask(handler.id, msg=str(refuse))
|
||||
return
|
||||
except koji.tasks.ServerRestart:
|
||||
# freeing this task will allow the pending restart to take effect
|
||||
self.session.host.freeTasks([handler.id])
|
||||
|
|
|
|||
|
|
@ -110,6 +110,11 @@ class ServerRestart(Exception):
|
|||
pass
|
||||
|
||||
|
||||
class RefuseTask(Exception):
|
||||
"""Raise to task handler to refuse a task"""
|
||||
pass
|
||||
|
||||
|
||||
def parse_task_params(method, params):
|
||||
"""Parse task params into a dictionary
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue