Index: scripts/slave/bootstrap.py |
diff --git a/scripts/slave/bootstrap.py b/scripts/slave/bootstrap.py |
index 8e3b3095043b5fe5a6a0884db506d36b02ccc4ab..dad47e6d77d8eb165d5d77e1d89a692acb33c8cb 100644 |
--- a/scripts/slave/bootstrap.py |
+++ b/scripts/slave/bootstrap.py |
@@ -8,7 +8,6 @@ buildbot or twisted code. |
import inspect |
import os |
-import socket |
import sys |
from common import chromium_utils |
@@ -18,13 +17,14 @@ import config_bootstrap |
def ImportMasterConfigs(master_name=None): |
"""Imports master configs. |
- Normally a slave can use GetActiveMaster() to find itself and |
- determine which ActiveMaster to use. In that case, the active |
- master name is passed in as an arg, and we only load the |
+ Normally a slave can use chromium_utils.GetActiveMaster() to find |
+ itself and determine which ActiveMaster to use. In that case, the |
+ active master name is passed in as an arg, and we only load the |
site_config.py that defines it. When testing, the current "slave" |
won't be found. In that case, we don't know which config to use, so |
load them all. In either case, masters are assigned as attributes |
- to the config.Master object.""" |
+ to the config.Master object. |
+ """ |
for master in chromium_utils.ListMasters(): |
path = os.path.join(master, 'master_site_config.py') |
if os.path.exists(path): |
@@ -44,26 +44,3 @@ def ImportMasterConfigs(master_name=None): |
# config_bootstrap.Master.active_master. |
if master_name and master_name == symbol_name: |
setattr(config_bootstrap.Master, 'active_master', symbol) |
- |
- |
-def GetActiveMaster(slavename=None): |
- """Parses all the slaves.cfg and returns the name of the active master |
- determined by the host name. Returns None otherwise. |
- |
- If a slavename is given, it will be matched against *both* the 'slavename' |
- and 'hostname' fields in slave.cfg. Otherwise, the machine's hostname will be |
- matched against only the 'hostname' field. |
- """ |
- if slavename is None: |
- config_keys = ['hostname'] |
- config_val = socket.getfqdn().split('.', 1)[0].lower() |
- else: |
- config_keys = ['slavename', 'hostname'] |
- config_val = slavename |
- for master in chromium_utils.ListMasters(): |
- path = os.path.join(master, 'slaves.cfg') |
- if os.path.exists(path): |
- for slave in chromium_utils.RunSlavesCfg(path): |
- for key in config_keys: |
- if slave.get(key, None) == config_val: |
- return slave['master'] |