fix(oem-rackspace): add coreos-setup-environment for rackspace

This commit is contained in:
Alex Polvi 2014-03-21 03:54:35 +00:00
parent 94e3404c2c
commit f7aa6084b7
2 changed files with 38 additions and 0 deletions

View File

@ -0,0 +1,35 @@
#!/bin/bash +x
ENV=$1
if [ -z "$ENV" ]; then
echo usage: $0 /etc/environment
exit 1
fi
# test for rw
touch $ENV
if [ $? -ne 0 ]; then
echo exiting, unable to modify: $ENV
exit 1
fi
sed -i -e '/^COREOS_PUBLIC_IPV4=/d' \
-e '/^COREOS_PRIVATE_IPV4=/d' \
"${ENV}"
# We spin loop until the nova-agent sets up the ip addresses
function get_ip () {
IF=$1
IP=
while [ 1 ]; do
IP=$(ifconfig $IF | awk '/inet /{print $2}')
if [ "$IP" != "" ]; then
break
fi
sleep .1
done
echo $IP
}
echo COREOS_PUBLIC_IPV4=$(get_ip eth0) >> $ENV
echo COREOS_PRIVATE_IPV4=$(get_ip eth1) >> $ENV

View File

@ -28,4 +28,7 @@ src_install() {
rsync --exclude=".git" -aq ${S}/ ${D}/nova-agent/
insinto "/"
doins ${FILESDIR}/cloud-config.yml
into "/"
dobin ${FILESDIR}/coreos-setup-environment
}