changeset 473:b1d346c4e539

Only accept build results from the slave that's supposed to be processing this build. Additional logging.
author wbell
date Wed, 05 Mar 2008 20:09:58 +0000
parents 5e84a4249858
children 8c3dfe0efe78
files bitten/master.py
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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()
 
Copyright (C) 2012-2017 Edgewall Software