3
from helpers import command, get_config, run, log
4
from subprocess import CalledProcessError
3
# Copyright 2012 Canonical Ltd. This software is licensed under the
4
# GNU Affero General Public License version 3 (see the file LICENSE).
8
log = command('juju-log')
10
# Log the fact that we're about to begin the install step.
17
buildbot_dir = config['installdir']
18
run('apt-get', 'install', '-y', 'sharutils', 'bzr')
20
# Install the extra repository
21
# Install the initially configured version of buildbot.
23
# Since we may be installing into a pre-existing service, ensure the
24
# buildbot directory is removed.
25
if os.path.exists(buildbot_dir):
27
run('buildbot', 'stop', buildbot_dir)
28
except CalledProcessError:
29
# It probably wasn't running; just ignore the error.
31
shutil.rmtree(buildbot_dir)
33
# Log the fact that the install step is done.
8
from subprocess import CalledProcessError
22
def bootstrap(buildbot_dir):
23
apt_get_install('bzr')
24
# Since we may be installing into a pre-existing service, ensure the
25
# buildbot directory is removed.
26
if os.path.exists(buildbot_dir):
28
run('buildbot', 'stop', buildbot_dir)
29
except (CalledProcessError, OSError):
30
# This usually happens because buildbot hasn't been
31
# installed yet, or that it wasn't running; just ignore the
34
shutil.rmtree(buildbot_dir)
35
# Initialize the cached config so that old configs don't hang around
36
# after the service is torn down.
45
bootstrap(config['installdir'])
48
if __name__ == '__main__':