Merge #398 Ignore koji messages with a null task id

This commit is contained in:
Ralph Bean
2017-03-03 15:04:42 +00:00
2 changed files with 15 additions and 0 deletions

View File

@@ -180,6 +180,13 @@ class BaseMessage(object):
msg_obj = None
# Ignore all messages from the secondary koji instances.
if category == 'buildsys':
instance = msg_inner_msg.get('instance', 'primary')
if instance != 'primary':
log.debug("Ignoring message from %r koji hub." % instance)
return
if category == 'buildsys' and object == 'build' and \
subobject == 'state' and event == 'change':
build_id = msg_inner_msg.get('build_id')
@@ -189,6 +196,10 @@ class BaseMessage(object):
build_version = msg_inner_msg.get('version')
build_release = msg_inner_msg.get('release')
if task_id is None:
log.debug("Saw a koji build change with no task_id.")
return
msg_obj = KojiBuildChange(
msg_id, build_id, task_id, build_new_state, build_name,
build_version, build_release)
@@ -228,6 +239,8 @@ class KojiBuildChange(BaseMessage):
def __init__(self, msg_id, build_id, task_id, build_new_state, build_name,
build_version, build_release, module_build_id=None,
state_reason=None):
if task_id is None:
raise ValueError("KojiBuildChange with a null task_id is invalid.")
super(KojiBuildChange, self).__init__(msg_id)
self.build_id = build_id
self.task_id = task_id

View File

@@ -50,6 +50,8 @@ def _finalize(config, session, msg, state):
log.debug("We have no record of %s" % nvr)
return
log.info("Saw relevant component build of %r from %r." % (nvr, msg.msg_id))
if msg.state_reason:
state_reason = msg.state_reason
elif state != koji.BUILD_STATES['COMPLETE']: