16 lines
509 B
Bash
Executable File
16 lines
509 B
Bash
Executable File
#!/bin/bash
|
|
set -eux
|
|
local_ip=`wget -O- http://169.254.169.254/2009-04-04/meta-data/local-ipv4 || true`
|
|
if [ -z "$local_ip" ]; then
|
|
echo "No Local IP found."
|
|
# Don't fail: not having access to the metadata server may be a post-boot
|
|
# configuration issue such as bridge late-bringup, or different default
|
|
# routes.
|
|
exit 0
|
|
fi
|
|
for f in /var/lib/heat-cfntools/cfn-init-data /var/cache/heat-cfntools/last_metadata ; do
|
|
if [ -e $f ] ; then
|
|
sed -i "s/\<0\.0\.0\.0\>/$local_ip/g" $f
|
|
fi
|
|
done
|