# HG changeset patch # User wbell # Date 1204747798 0 # Node ID b1d346c4e53928cb6eb143608d8e1fc1261c05a8 # Parent 5e84a424985836cc21e483b725cfb6882f3b3974 Only accept build results from the slave that's supposed to be processing this build. Additional logging. diff --git a/bitten/master.py b/bitten/master.py --- a/bitten/master.py +++ b/bitten/master.py @@ -174,6 +174,9 @@ xml.attr['build'] = str(build.id) body = str(xml) + self.log.info('Build slave %r initiated build %d', build.slave, + build.id) + req.send_response(200) req.send_header('Content-Type', 'application/x-bitten+xml') req.send_header('Content-Length', str(len(body))) @@ -189,6 +192,10 @@ except xmlio.ParseError, e: raise HTTPBadRequest('XML parser error') stepname = elem.attr['step'] + + # make sure it's the right slave. + if build.status != Build.IN_PROGRESS or build.slave_info.get(Build.IP_ADDRESS) != req.remote_addr: + raise HTTPForbidden('Build %s has been invalidated for host %s.' % (build.id, req.remote_addr)) step = BuildStep.fetch(self.env, build=build.id, name=stepname) if step: @@ -205,8 +212,8 @@ raise HTTPForbidden('No such build step') last_step = index == num - self.log.debug('Slave %s completed step %d (%s) with status %s', - build.slave, index, stepname, elem.attr['status']) + self.log.debug('Slave %s (build %d) completed step %d (%s) with status %s', + build.slave, build.id, index, stepname, elem.attr['status']) db = self.env.get_db_cnx()