guests/debian: Exit on error when configuring hostname
This commit is contained in:
parent
9134172ce6
commit
7a7256b3ab
|
@ -12,6 +12,8 @@ module VagrantPlugins
|
||||||
if !comm.test("hostname -f | grep '^#{name}$'", sudo: false)
|
if !comm.test("hostname -f | grep '^#{name}$'", sudo: false)
|
||||||
basename = name.split(".", 2)[0]
|
basename = name.split(".", 2)[0]
|
||||||
comm.sudo <<-EOH.gsub(/^ {14}/, '')
|
comm.sudo <<-EOH.gsub(/^ {14}/, '')
|
||||||
|
set -e
|
||||||
|
|
||||||
# Set the hostname
|
# Set the hostname
|
||||||
echo '#{basename}' > /etc/hostname
|
echo '#{basename}' > /etc/hostname
|
||||||
hostname -F /etc/hostname
|
hostname -F /etc/hostname
|
||||||
|
@ -28,16 +30,16 @@ module VagrantPlugins
|
||||||
echo '#{name}' > /etc/mailname
|
echo '#{name}' > /etc/mailname
|
||||||
|
|
||||||
# Restart networking and force new DHCP
|
# Restart networking and force new DHCP
|
||||||
if [ test -f /etc/init.d/hostname.sh ]; then
|
if test -f /etc/init.d/hostname.sh; then
|
||||||
invoke-rc.d hostname.sh start
|
invoke-rc.d hostname.sh start || true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ test -f /etc/init.d/networking ]; then
|
if test -f /etc/init.d/networking; then
|
||||||
invoke-rc.d networking force-reload
|
invoke-rc.d networking force-reload || true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ test -f /etc/init.d/network-manager ]; then
|
if test -f /etc/init.d/network-manager; then
|
||||||
invoke-rc.d network-manager force-reload
|
invoke-rc.d network-manager force-reload || true
|
||||||
fi
|
fi
|
||||||
EOH
|
EOH
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue