In some environments, hostname returns a hostname with a
default domain, e.g novalocal. This domain may conflict
with the dns_domain option setting. Added a test to strip
off domain if that happens.
Issue-Id: DCAEGEN2-128
Change-Id: Ie4995f542305e465ec11689acccc053f081f2df2
Signed-off-by: Lusheng Ji <lji@research.att.com>
CONSULNAME=consul_${CONSULVER}_linux_amd64
MYIP=`curl -Ss http://169.254.169.254/2009-04-04/meta-data/local-ipv4`
MYNAME=`hostname`
+ if [ ! -z "$(echo $MYNAME |grep '.')" ]; then MYNAME="$(echo $MYNAME | cut -f1 -d '.')"; fi
echo >>/etc/hosts
echo $MYIP $MYNAME >>/etc/hosts
mkdir -p /opt/consul/config /opt/consul/data /opt/consul/bin