Merge pull request #166 from marineam/etcd

Etcd arg updates
This commit is contained in:
Michael Marineau 2013-08-19 16:16:52 -07:00
commit c79427d392
2 changed files with 5 additions and 3 deletions

View File

@ -2,7 +2,7 @@
VIRT=$(coreos-detect-virt) VIRT=$(coreos-detect-virt)
STATE=/var/lib/etcd STATE=/var/lib/etcd
DEFAULT_ARGS="-v -d $STATE -f" DEFAULT_ARGS="-d $STATE -f"
if [ "${VIRT}" != "ec2" ]; then if [ "${VIRT}" != "ec2" ]; then
echo "Detected environment \"${VIRT}\", just starting solo master..." echo "Detected environment \"${VIRT}\", just starting solo master..."
@ -16,14 +16,16 @@ BOOTSTRAP="/var/run/etcd/bootstrap.config"
[ ! -e $BOOTSTRAP ] && echo bootstrap config missing && exit 1 [ ! -e $BOOTSTRAP ] && echo bootstrap config missing && exit 1
CLUSTER_ARGS="-n $MY_IP -c $MY_IP:4001 -s $MY_IP:7001"
# strip blank lines # strip blank lines
IPS=$(grep -v $MY_IP $BOOTSTRAP|grep -v '^\n$' |sed 's/$/:7001/'|tr '\n' ','|sed 's/^,//'|sed 's/,$//') IPS=$(grep -v $MY_IP $BOOTSTRAP|grep -v '^\n$' |sed 's/$/:7001/'|tr '\n' ','|sed 's/^,//'|sed 's/,$//')
if [ -z "$IPS" ]; then if [ -z "$IPS" ]; then
echo "becoming master..." echo "becoming master..."
exec /usr/bin/etcd ${DEFAULT_ARGS} -h $MY_IP exec /usr/bin/etcd ${DEFAULT_ARGS} ${CLUSTER_ARGS}
else else
echo "trying $IPS" echo "trying $IPS"
set -x set -x
exec /usr/bin/etcd ${DEFAULT_ARGS} -h $MY_IP -C "$IPS" exec /usr/bin/etcd ${DEFAULT_ARGS} ${CLUSTER_ARGS} -C "$IPS"
fi fi