changeset 86:110bfa3cbc32

Slaves were getting associated with the wrong target platform.
author cmlenz
date Sun, 10 Jul 2005 20:44:05 +0000
parents acb7b67b8152
children 94b703e2114d
files bitten/master.py bitten/slave.py
diffstat 2 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/bitten/master.py
+++ b/bitten/master.py
@@ -96,7 +96,7 @@
             return
         logging.debug('Checking for pending builds...')
         for build in Build.select(self.env, status=Build.PENDING):
-            for slave in self.slaves[build.platform]:
+            for slave in self.slaves.get(build.platform, []):
                 active_builds = Build.select(self.env, slave=slave.name,
                                              status=Build.IN_PROGRESS)
                 if not list(active_builds):
@@ -125,13 +125,11 @@
             for platform in TargetPlatform.select(self.env, config=config.name):
                 if not platform.id in self.slaves:
                     self.slaves[platform.id] = set()
-                logging.debug('Matching slave %s against rules: %s',
-                              handler.name, platform.rules)
                 match = True
                 for property, pattern in ifilter(None, platform.rules):
                     try:
                         if not re.match(pattern, handler.info.get(property)):
-                            match = any_match = False
+                            match = False
                             break
                     except re.error, e:
                         logging.error('Invalid platform matching pattern "%s"',
@@ -139,7 +137,10 @@
                         match = False
                         break
                 if match:
+                    logging.info('Slave %s matched target platform %s',
+                                 handler.name, platform.name)
                     self.slaves[platform.id].add(handler)
+                    any_match = True
 
         if not any_match:
             logging.warning('Slave %s does not match any of the configured '
--- a/bitten/slave.py
+++ b/bitten/slave.py
@@ -60,8 +60,8 @@
                 if msg.get_content_type() == beep.BEEP_XML:
                     elem = xmlio.parse(msg.get_payload())
                     if elem.name == 'error':
-                        raise beep.TerminateSession, '%s (%d)' \
-                            % (elem.gettext(), int(elem.attr['code']))
+                        logging.error('Slave registration failed: %s (%d)',
+                                      elem.gettext(), int(elem.attr['code']))
                 raise beep.TerminateSession, 'Registration failed!'
             logging.info('Registration successful')
 
Copyright (C) 2012-2017 Edgewall Software