From 0af02fc78c119af7d4621ebc0b5bc7adadc8554c Mon Sep 17 00:00:00 2001 From: Seth Vargo Date: Fri, 24 Jun 2016 19:28:46 -0400 Subject: [PATCH] guests/atomic: Ensure error exit when setting hostname --- plugins/guests/atomic/cap/change_host_name.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/guests/atomic/cap/change_host_name.rb b/plugins/guests/atomic/cap/change_host_name.rb index 74fd081ab..2c501c8dd 100644 --- a/plugins/guests/atomic/cap/change_host_name.rb +++ b/plugins/guests/atomic/cap/change_host_name.rb @@ -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