~bac/charms/oneiric/buildbot-master/initial

« back to all changes in this revision

Viewing changes to hooks/config-changed

  • Committer: Brad Crittenden
  • Date: 2012-01-30 14:43:09 UTC
  • Revision ID: bac@canonical.com-20120130144309-pe2nwfmwa2xg4tg7
Incorporated changes (some) from review

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 
16
16
#
17
17
if [[ -n $CONFIG_FILE ]]; then
18
 
    echo "$CONFIG_FILE" | uudecode -o $BUILDBOT_DIR/master.cfg
 
18
    echo "$CONFIG_FILE" | uudecode -o "$BUILDBOT_DIR"/master.cfg
19
19
    juju-log "Config decoded and written."
20
20
elif [ "$CONFIG_TRANSPORT" == "bzr" ] && [[ -n $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.
 
21
    # If the branch is private then more setup needs to be done.  The
 
22
    # gpg-agent needs to send the key over and the bzr launchpad-login
 
23
    # needs to be set. 
23
24
    LP_ID=`config-get config-user`
24
25
    if [[ -n $LP_ID ]]; then
25
26
        bzr launchpad-login $LP_ID
31
32
        chmod 700 ~/.ssh
32
33
        echo "$PKEY" | uudecode -o ~/.ssh/lp_key
33
34
    fi
34
 
    bzr branch --use-existing-dir $CONFIG_URL $BUILDBOT_DIR
35
 
    chown -R ubuntu:ubuntu $BUILDBOT_DIR
 
35
    bzr branch --use-existing-dir $CONFIG_URL "$BUILDBOT_DIR"
 
36
    chown -R ubuntu:ubuntu "$BUILDBOT_DIR"
36
37
fi
37
38
 
38
39
# Restart buildbot if it is running.
39
 
PIDFILE=$BUILDBOT_DIR/twistd.pid
 
40
PIDFILE="$BUILDBOT_DIR"/twistd.pid
40
41
if [ -f $PIDFILE ]; then
41
42
  BUILDBOT_PID=`cat $PIDFILE`
42
43
  if kill -0 $BUILDBOT_PID; then
43
44
    # Buildbot is running, reconfigure it.
44
45
    juju-log "Reconfiguring buildbot"
45
 
    buildbot reconfig $BUILDBOT_DIR
 
46
    buildbot reconfig "$BUILDBOT_DIR"
46
47
    juju-log "Buildbot reconfigured"
47
48
  fi
48
49
fi