Merge lp:~frankban/charms/oneiric/buildbot-master/02-14-tests into lp:~yellow/charms/oneiric/buildbot-master/trunk

Proposed by Francesco Banconi
Status: Merged
Approved by: Graham Binns
Approved revision: 34
Merged at revision: 32
Proposed branch: lp:~frankban/charms/oneiric/buildbot-master/02-14-tests
Merge into: lp:~yellow/charms/oneiric/buildbot-master/trunk
Diff against target: 46 lines (+6/-5)
2 files modified
hooks/config-changed (+0/-1)
hooks/install (+6/-4)
To merge this branch: bzr merge lp:~frankban/charms/oneiric/buildbot-master/02-14-tests
Reviewer Review Type Date Requested Status
Graham Binns (community) Approve
Review via email: mp+93032@code.launchpad.net

Description of the change

*Changes from frankban and gmb*:

The `cleanup` function in the install hook now stops (if running) buildbot using the installdir previously stored in the config JSON file.

*Tests*:

$ RESOLVE_TEST_CHARMS=1 tests/buildbot-master.test -v
test_lpbuildbot (__main__.TestCharm) ... ok
test_port_opened (__main__.TestCharm) ... ok

----------------------------------------------------------------------
Ran 2 tests in 358.658s

OK

To post a comment you must log in.
Revision history for this message
Graham Binns (gmb) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hooks/config-changed'
2--- hooks/config-changed 2012-02-14 11:53:08 +0000
3+++ hooks/config-changed 2012-02-14 17:33:19 +0000
4@@ -7,7 +7,6 @@
5 import os
6 import os.path
7 import shutil
8-import StringIO
9 import sys
10
11 from helpers import (
12
13=== modified file 'hooks/install'
14--- hooks/install 2012-02-14 11:45:55 +0000
15+++ hooks/install 2012-02-14 17:33:19 +0000
16@@ -21,7 +21,7 @@
17 )
18
19
20-def bootstrap(buildbot_dir):
21+def cleanup(buildbot_dir):
22 apt_get_install('bzr')
23 # Since we may be installing into a pre-existing service, ensure the
24 # buildbot directory is removed.
25@@ -30,8 +30,8 @@
26 run('buildbot', 'stop', buildbot_dir)
27 except (CalledProcessError, OSError):
28 # This usually happens because buildbot hasn't been
29- # installed yet, or that it wasn't running; just ignore the
30- # error.
31+ # installed yet, or that it wasn't running; just
32+ # ignore the error.
33 pass
34 shutil.rmtree(buildbot_dir)
35 # Initialize the cached config so that old configs don't hang around
36@@ -46,7 +46,9 @@
37 config = get_config()
38 log("config:")
39 log(str(config))
40- bootstrap(config['installdir'])
41+ old_config = config_json.get()
42+ buildbot_dir = old_config.get('installdir', config['installdir'])
43+ cleanup(buildbot_dir)
44
45
46 if __name__ == '__main__':

Subscribers

People subscribed via source and target branches