diff options
author | Lusheng Ji <lji@research.att.com> | 2017-10-25 12:13:28 -0400 |
---|---|---|
committer | Lusheng Ji <lji@research.att.com> | 2017-10-25 12:13:34 -0400 |
commit | 9a3daed8316f7c455b53250217d36172593236a4 (patch) | |
tree | edaf486b22c02c9a1cef747b756b0c16e293cd1c | |
parent | 0788d68a70b6bd62197e2246b0288c5adfacfdc7 (diff) |
Make sure hostname has no domain
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>
-rw-r--r-- | blueprints/centos_vm.yaml-template | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/blueprints/centos_vm.yaml-template b/blueprints/centos_vm.yaml-template index 1211625..aa3bdb4 100644 --- a/blueprints/centos_vm.yaml-template +++ b/blueprints/centos_vm.yaml-template @@ -75,6 +75,7 @@ inputs: 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 |