view talosnames/ @ 17:25e91fc7ff01

getting the test config now works
author Jeff Hammel <>
date Tue, 10 Jul 2012 18:23:16 -0700
parents 1713b3e244a7
line wrap: on
line source

#!/usr/bin/env python

correlate names of talos

import api
import optparse
import subprocess
import sys
from commandparser import CommandParser
from pprint import pprint

class TalosNamesCLI(object):
    def __init__(self):
        self.api = api.TalosNames()

    def graphserver(self, *names):
        """give graphserver names from test names"""
        if not names:
            names = [None]
        for arg in names:
            for name, graphserver_name in self.api(arg):
                print '%s : %s' % (name, graphserver_name)

    def tbpl(self, name):
        """give TBPL name given the buildbot config name"""
        return self.api.tbpl_name(name)

    def suites(self):
        """list the buildbot suites"""
        suites = sorted(self.api.suites.keys())
        return suites

    def command(self, suite):
        """returns the command that buildbot runs for a particular suite"""
        command = self.api.buildbot_command(suite)
        assert command is not None, "Suite not found; should be one of %s" % ', '.join(self.suites())
        return subprocess.list2cmdline(command)

    def tests(self, suite):
        """return the talos test config for a buildbot suite name"""
        return self.api.test_config(suite)

def main(args=sys.argv[1:]):
    parser = CommandParser(TalosNamesCLI)

if __name__ == '__main__':