~charmers/charms/precise/buildbot-master/trunk

« back to all changes in this revision

Viewing changes to hooks/stop

  • Committer: Francesco Banconi
  • Date: 2012-02-07 14:37:13 UTC
  • mfrom: (11.1.8 dynamic-relationship)
  • Revision ID: francesco.banconi@canonical.com-20120207143713-7ycviq0xpp8roffy
Merged branch dynamic-relationship and added cleanup fixes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/bin/bash
2
 
# This will be run when the service is being torn down, allowing you to disable
3
 
# it in various ways..
4
 
# For example, if your web app uses a text file to signal to the load balancer
5
 
# that it is live... you could remove it and sleep for a bit to allow the load
6
 
# balancer to stop sending traffic.
7
 
# rm /srv/webroot/server-live.txt && sleep 30
8
 
 
9
 
BUILDBOT_DIR=`config-get installdir`
10
 
 
11
 
juju-log "<-- stop"
12
 
juju-log "Stopping buildbot in $BUILDBOT_DIR"
13
 
close-port 8010/TCP
14
 
buildbot stop $BUILDBOT_DIR
15
 
juju-log "Finished stopping buildbot"
16
 
juju-log "--> stop"
 
1
#!/usr/bin/python
 
2
 
 
3
# Copyright 2012 Canonical Ltd.  This software is licensed under the
 
4
# GNU Affero General Public License version 3 (see the file LICENSE).
 
5
 
 
6
from helpers import (
 
7
    get_config,
 
8
    log,
 
9
    run,
 
10
    )
 
11
 
 
12
 
 
13
def main():
 
14
    config = get_config()
 
15
    log('Stopping buildbot in {}'.format(config['installdir']))
 
16
    run('close-port', '8010/TCP')
 
17
 
 
18
    log('Finished stopping buildbot')
 
19
 
 
20
 
 
21
if __name__ == '__main__':
 
22
    log('STOP HOOK:')
 
23
    main()