fix(dev-db/etcd): Require c10n, start even if cluster config is missing.

If c10n fails etcd should not start, wait until it is known if there is
a cluster config to use or not. Also now c10n may not write out a
cluster config on ec2 if there isn't a need for one. Make this case
non-fatal and start up etcd as a master node.
This commit is contained in:
Michael Marineau 2014-02-11 16:02:29 -08:00
parent 8f6f6007a0
commit 0655858328
3 changed files with 6 additions and 5 deletions

View File

@ -18,7 +18,11 @@ BOOTSTRAP_PEERS="/var/run/etcd/bootstrap.config"
BOOTSTRAP_DISCO="/var/run/etcd/bootstrap.disco" BOOTSTRAP_DISCO="/var/run/etcd/bootstrap.disco"
META_URL="http://169.254.169.254/latest" META_URL="http://169.254.169.254/latest"
MY_IP=$(curl -s $META_URL/meta-data/local-ipv4) MY_IP=$(curl --fail -s $META_URL/meta-data/local-ipv4)
if [ $? -ne 0 ]; then
echo "Request to meta-data service failed" >&2
exit 1
fi
ARGS="${ARGS} -name ${MY_IP} -addr ${MY_IP}:4001 -peer-addr ${MY_IP}:7001 -peer-bind-addr 0.0.0.0" ARGS="${ARGS} -name ${MY_IP} -addr ${MY_IP}:4001 -peer-addr ${MY_IP}:7001 -peer-bind-addr 0.0.0.0"
@ -31,9 +35,6 @@ elif [ -e $BOOTSTRAP_PEERS ]; then
if [ -n "$IPS" ]; then if [ -n "$IPS" ]; then
ARGS="${ARGS} -C ${IPS}" ARGS="${ARGS} -C ${IPS}"
fi fi
else
echo "Could not find any bootstrap configuration"
exit 1
fi fi
exec /usr/bin/etcd $ARGS exec /usr/bin/etcd $ARGS

View File

@ -1,6 +1,6 @@
[Unit] [Unit]
Description=etcd Description=etcd
Wants=coreos-c10n.service Requires=coreos-c10n.service
After=coreos-c10n.service After=coreos-c10n.service
[Service] [Service]