use legacy hostnames in c10n

This commit is contained in:
Alex Polvi 2014-03-18 18:25:32 +00:00
parent 81b2c916eb
commit 3c959167d8

View File

@ -13,6 +13,7 @@ ETCD_SERVICE_D="/run/systemd/system/etcd.service.d"
mkdir -p $ETCD_SERVICE_D
/usr/bin/block-until-url $META_URL
IP=$(curl -s $META_URL/meta-data/local-ipv4)
# Attempt to download userdata, exiting on failure or no user-data is found
USER_DATA=$(curl -s --fail $META_URL/user-data)
@ -85,7 +86,8 @@ fi
if [ -n "${ETCD_DISCOVERY_URL}" ]; then
echo "Using '${ETCD_DISCOVERY_URL}' as etcd discovery url"
echo "[Service]
Environment=ETCD_DISCOVERY=${ETCD_DISCOVERY}" > ${ETCD_SERVICE_D}/11-c10n.conf
Environment=ETCD_DISCOVERY=${ETCD_DISCOVERY}
Environment=ETCD_NAME=${IP}" > ${ETCD_SERVICE_D}/21-c10n.conf
# ...otherwise, we treat the provided user-data as a legacy c10n URL
elif [ -n "${C10N_TOKEN}" ]; then
depwarn "Bootstrapping etcd with the c10n service is deprecated."
@ -95,11 +97,11 @@ elif [ -n "${C10N_TOKEN}" ]; then
# Assert we have networking up and able to access the c10n service
/usr/bin/block-until-url $C10N_ENDPOINT
IP=$(curl -s $META_URL/meta-data/local-ipv4)
ETCD_PEERS=$(curl -s $C10N_ENDPOINT -d "c10n_url=$C10N_TOKEN" -d"ip_list=$IP")
echo "[Service]" > ${ETCD_SERVICE_D}/12-c10n.conf
echo "[Service]
Environment=ETCD_NAME=${IP}" > ${ETCD_SERVICE_D}/22-c10n.conf
for peer in $ETCD_PEERS; do
echo "Environment=ETCD_PEERS=${peer}" >> ${ETCD_SERVICE_D}/12-c10n.conf
echo "Environment=ETCD_PEERS=${peer}" >> ${ETCD_SERVICE_D}/22-c10n.conf
done
fi