Charm: oneiric/hadoop-mapreduce   Revision: 5   Hook: hadoop-master-relation-changed
#!/bin/bash
# This must be renamed to the name of the relation. The goal here is to
# affect any change needed by relationships being formed, modified, or broken
# This script should be idempotent.
set -ux
NAMENODE=`relation-get namenode`
if [ -z "$NAMENODE" ]; then
	exit 0
fi
JOBTRACKER=`relation-get jobtracker`
if [ -z "$JOBTRACKER" ]; then
	exit 0
fi
HDFSDATADIR=`relation-get hdfsdatadir`
if [ -z "$HDFSDATADIR" ]; then
	exit 0
fi

echo debconf hadoop/namenode string ${NAMENODE}| /usr/bin/debconf-set-selections
echo debconf hadoop/jobtracker string ${JOBTRACKER}| /usr/bin/debconf-set-selections
echo debconf hadoop/hdfsdatadir string ${HDFSDATADIR}| /usr/bin/debconf-set-selections

DEBIAN_FRONTEND=noninteractive dpkg-reconfigure hadoop-0.20-datanode
DEBIAN_FRONTEND=noninteractive dpkg-reconfigure hadoop-0.20-tasktracker

service hadoop-0.20-datanode restart
service hadoop-0.20-tasktracker restart

echo $JUJU_REMOTE_UNIT modified its settings
echo Relation settings:
relation-get
echo Relation members:
relation-list
true