guests/atomic: Ensure error exit when setting hostname

This commit is contained in:
Seth Vargo 2016-06-24 19:28:46 -04:00
parent ccc40eb19d
commit 0af02fc78c
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