#!/usr/bin/env python

import os
import sys
path = os.path.join(os.path.dirname(__file__), os.path.pardir, 'common')
sys.path.append(path)
import chromium_utils

slaves = []
for master in chromium_utils.ListMasters():
  masterbase = os.path.basename(master)
  master_slaves = {}
  execfile(os.path.join(master, 'slaves.cfg'), master_slaves)
  for slave in master_slaves.get('slaves', []):
    slave['master'] = masterbase
  slaves.extend(master_slaves.get('slaves', []))
for slave in sorted(slaves, cmp=None, key=lambda x : x.get('hostname', '')):
  slavename = slave.get('hostname')
  if not slavename:
    continue
  osname = slave.get('os', '?')
  print '%-30s %-35s %-10s' % (slavename, slave.get('master', '?'), osname)

#!/usr/bin/env python
# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

"""Dumps a list of known slaves, along with their OS and master."""

import os
import sys
path = os.path.join(os.path.dirname(__file__), os.path.pardir)
sys.path.append(path)
from common import chromium_utils

slaves = []
for master in chromium_utils.ListMasters():
  masterbase = os.path.basename(master)
  master_slaves = {}
  execfile(os.path.join(master, 'slaves.cfg'), master_slaves)
  for slave in master_slaves.get('slaves', []):
    slave['master'] = masterbase
  slaves.extend(master_slaves.get('slaves', []))
for slave in sorted(slaves, cmp=None, key=lambda x : x.get('hostname', '')):
  slavename = slave.get('hostname')
  if not slavename:
    continue
  osname = slave.get('os', '?')
  print '%-30s %-35s %-10s' % (slavename, slave.get('master', '?'), osname)

Tweak import statement to satisfy presubmit checks.
Tweak import statement to satisfy presubmit checks.

Review URL: http://codereview.chromium.org/8292004

git-svn-id: 239fca9b83025a0b6f823aeeca02ba5be3d9fd76@105578 0039d316-1c4b-4281-b951-d872f2087c98
