guests/ubuntu: Use short hostname

Fixes GH-7488
This commit is contained in:
Seth Vargo 2016-06-22 18:34:37 -07:00
parent caafb936f0
commit 4664930e06
No known key found for this signature in database
GPG Key ID: 905A90C2949E8787
1 changed files with 2 additions and 2 deletions

View File

@ -9,11 +9,11 @@ module VagrantPlugins
basename = name.split(".", 2)[0] basename = name.split(".", 2)[0]
comm.sudo <<-EOH.gsub(/^ {14}/, '') comm.sudo <<-EOH.gsub(/^ {14}/, '')
# Set the hostname # Set the hostname
echo '#{name}' > /etc/hostname echo '#{basename}' > /etc/hostname
hostname -F /etc/hostname hostname -F /etc/hostname
if command -v hostnamectl; then if command -v hostnamectl; then
hostnamectl set-hostname '#{name}' hostnamectl set-hostname '#{basename}'
fi fi
# Remove comments and blank lines from /etc/hosts # Remove comments and blank lines from /etc/hosts