~benji/charms/oneiric/buildbot-master/remove-base64

« back to all changes in this revision

Viewing changes to hooks/config-changed

  • Committer: Brad Crittenden
  • Date: 2012-01-25 15:21:32 UTC
  • Revision ID: bac@canonical.com-20120125152132-5h9xyse0c39v6u24
Incomplete work towards config directory checkout

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
# Hook for handling config changes.
3
3
set -eux # -x for verbose logging to juju debug-log
4
4
 
5
 
# Config is changed via juju like:
6
 
# juju set buildbot-master config=$(uuencode -m master.cfg master.cfg)
 
5
# config_file is changed via juju like:
 
6
# juju set buildbot-master config-file=`uuencode master.cfg`
7
7
 
8
8
BUILDBOT_DIR=`config-get installdir`
9
9
juju-log "--> config-changed"
10
10
 
11
11
juju-log "Updating buildbot configuration."
12
 
CONFIG=`config-get config`
13
 
echo "$CONFIG" | uudecode -o $BUILDBOT_DIR/master.cfg
14
 
juju-log "Config decoded and written."
 
12
CONFIG_FILE=`config-get config-file`
 
13
CONFIG_TRANSPORT=`config-get config-transport`
 
14
CONFIG_URL=`config-get config-url`
 
15
 
 
16
#
 
17
if [ "$CONFIG_FILE" != "" ]; then
 
18
    echo "$CONFIG_FILE" | uudecode -o $BUILDBOT_DIR/master.cfg
 
19
    juju-log "Config decoded and written."
 
20
elif [ "$CONFIG_TRANSPORT" == "bzr" ] && [ "$CONFIG_URL" != "" ]; then
 
21
    # If the branch is private then more setup needs to be done.  The gpg-agent needs to send the key over and the
 
22
    # bzr launchpad-login needs to be set.
 
23
    bzr launchpad-login `config-get config-user`
 
24
    # Set up the .ssh directory.
 
25
    mkdir ~/.ssh
 
26
    chmod 700 ~/.ssh
 
27
    PKEY=`config-get config-private-key`
 
28
    echo "$PKEY" | uudecode -o ~/.ssh/lp_key
 
29
    bzr branch $CONFIG_URL $BUILDBOT_DIR
 
30
fi
15
31
 
16
32
# Restart buildbot if it is running.
17
33
PIDFILE=$BUILDBOT_DIR/twistd.pid