~gary/charms/precise/buildbot-master/add-max-builds-support

« back to all changes in this revision

Viewing changes to hooks/local.py

  • Committer: Brad Crittenden
  • Date: 2012-02-23 21:52:38 UTC
  • mfrom: (32.2.3 bbm-cleanup)
  • Revision ID: bac@canonical.com-20120223215238-njidb4hjtnrtjcfz
[r=gary_poster] Rename our master config wrapper to wrapper.cfg.  Use the --config option to buildbdbot create-master to make wrapper.cfg the expected config file.  This avoids the need to move master.cfg to master.cfg.orginal.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
    'generate_string',
15
15
    'get_bucket',
16
16
    'get_key',
 
17
    'get_wrapper_cfg_path',
17
18
    'HTTP_PORT_PROTOCOL',
18
19
    'put_history',
19
20
    'slave_json',
 
21
    'WRAPPER_FN',
20
22
    ]
21
23
 
22
24
import os
35
37
 
36
38
 
37
39
HTTP_PORT_PROTOCOL = '8010/TCP'
 
40
WRAPPER_FN = 'wrapper.cfg'
38
41
 
39
42
 
40
43
def _get_buildbot_dir():
42
45
    return config.get('installdir')
43
46
 
44
47
 
 
48
def _get_tac_filename(buildbot_dir):
 
49
    return os.path.join(buildbot_dir, 'buildbot.tac')
 
50
 
 
51
 
 
52
def get_wrapper_cfg_path():
 
53
    return os.path.join(
 
54
        _get_buildbot_dir(), WRAPPER_FN)
 
55
 
 
56
 
45
57
def generate_string(prefix=""):
46
58
    """Generate a unique string and return it."""
47
59
    return prefix + uuid.uuid4().hex
49
61
 
50
62
def buildbot_create(buildbot_dir):
51
63
    """Create a buildbot instance in `buildbot_dir`."""
52
 
    if not os.path.exists(os.path.join(buildbot_dir, 'buildbot.tac')):
 
64
    if not os.path.exists(_get_tac_filename(buildbot_dir)):
53
65
        with su('buildbot'):
54
 
            return run('buildbot', 'create-master', buildbot_dir)
 
66
            return run(
 
67
                'buildbot', 'create-master', '--config', WRAPPER_FN,
 
68
                buildbot_dir)
55
69
 
56
70
 
57
71
def buildbot_running(buildbot_dir):
108
122
            log('<-- Starting buildbot')
109
123
 
110
124
 
111
 
def _get_tac_filename(buildbot_dir):
112
 
    return os.path.join(buildbot_dir, 'buildbot.tac')
113
 
 
114
 
 
115
125
def buildslave_stop(buildbot_dir=None):
116
126
    if buildbot_dir is None:
117
127
        buildbot_dir = _get_buildbot_dir()