guests/arch: Ensure exit on error setting hostname

This commit is contained in:
Seth Vargo 2016-06-24 19:06:02 -04:00
parent 084d62b5a6
commit cf9a8e3c0a
No known key found for this signature in database
GPG Key ID: 905A90C2949E8787
1 changed files with 3 additions and 0 deletions

View File

@ -8,6 +8,9 @@ module VagrantPlugins
if !comm.test("hostname -f | grep '^#{name}$'", sudo: false)
basename = name.split(".", 2)[0]
comm.sudo <<-EOH.gsub(/^ {14}/, "")
set -e
# Set hostname
hostnamectl set-hostname '#{basename}'
# Remove comments and blank lines from /etc/hosts