# HG changeset patch # User cmlenz # Date 1121028245 0 # Node ID 110bfa3cbc32b32b018cfe56869a5f8510efde03 # Parent acb7b67b8152b15db034a68bc9e8b075669899e6 Slaves were getting associated with the wrong target platform. diff --git a/bitten/master.py b/bitten/master.py --- 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 ' diff --git a/bitten/slave.py b/bitten/slave.py --- 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')