Sha256: 38cf09743a63828b2419bbb01a98a2210a0e610f56cb6e606361d64329f78492

Contents?: true

Size: 1.71 KB

Versions: 45

Compression:

Stored size: 1.71 KB

Contents

"""
This module contains the classes and methods which help load the
list of available build slaves based on the configuration.
"""

from buildbot.buildslave import BuildSlave

class BuildSlavesFromSlaveConfigs(list):
    """
    This object turns the ``SlaveConfig`` objects into actual
    ``BuildSlave`` objects. This list can be directly used as the
    setting.
    """

    def __init__(self, configs):
        for config in configs:
            self.append(BuildSlave(config.name, config.password))

class SlaveListFromConfig(list):
    """
    This object knows how to parse the slave configuration settings
    and load them into ``SlaveConfig`` value objects. The results
    can be read directly from this list.
    """

    def __init__(self, config):
        for config in self._slave_configs(config):
            self.append(config)

    def _slave_configs(self, config):
        """
        Returns an array of all the slaves that were configured
        with the given configuration string.
        """
        results = []
        for single in config.split(","):
            results.append(SlaveConfig(*single.split(":")))

        return results

class SlaveConfig(object):
    """
    This is a value class, meant to be immutable, representing
    the configuration of a single slave.
    """

    def __init__(self, name, password):
        self.name = name
        self.password = password

    def __eq__(self, other):
        """
        Provides equality tests for slave configurations, specifically
        for tests.
        """
        return self.__dict__ == other.__dict__

# Shortcut methods to make things a bit nicer
def get_slaves_from_config(config):
    return BuildSlavesFromSlaveConfigs(SlaveListFromConfig(config))

Version data entries

45 entries across 45 versions & 6 rubygems

Version Path
bmhatfield-vagrant-1.0.10 test/buildbot/buildbot_config/master/slaves.py
bmhatfield-vagrant-1.0.9 test/buildbot/buildbot_config/master/slaves.py
bmhatfield-vagrant-1.0.8 test/buildbot/buildbot_config/master/slaves.py
bmhatfield-vagrant-1.0.7 test/buildbot/buildbot_config/master/slaves.py
vagrantup-1.0.7 test/buildbot/buildbot_config/master/slaves.py
vagrantup-1.0.6 test/buildbot/buildbot_config/master/slaves.py
vagrantup-1.0.5 test/buildbot/buildbot_config/master/slaves.py
vagrantup-1.0.4 test/buildbot/buildbot_config/master/slaves.py
vagrantup-1.0.3 test/buildbot/buildbot_config/master/slaves.py
vagrantup-1.0.2 test/buildbot/buildbot_config/master/slaves.py
vagrantup-1.0.1 test/buildbot/buildbot_config/master/slaves.py
vagrantup-1.0.0 test/buildbot/buildbot_config/master/slaves.py
vagrantup-0.9.99.2 test/buildbot/buildbot_config/master/slaves.py
vagrantup-0.9.99.1 test/buildbot/buildbot_config/master/slaves.py
vagrantup-0.9.7 test/buildbot/buildbot_config/master/slaves.py
vagrantup-0.9.6 test/buildbot/buildbot_config/master/slaves.py
vagrantup-0.9.5 test/buildbot/buildbot_config/master/slaves.py
vagrantup-0.9.4 test/buildbot/buildbot_config/master/slaves.py
vagrantup-0.9.3 test/buildbot/buildbot_config/master/slaves.py
vagrantup-0.9.2 test/buildbot/buildbot_config/master/slaves.py