From cf9a8e3c0a4e42f0d4618cab84c17b26607e336c Mon Sep 17 00:00:00 2001 From: Seth Vargo Date: Fri, 24 Jun 2016 19:06:02 -0400 Subject: [PATCH] guests/arch: Ensure exit on error setting hostname --- plugins/guests/arch/cap/change_host_name.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/guests/arch/cap/change_host_name.rb b/plugins/guests/arch/cap/change_host_name.rb index d604cf9bf..0b10112e1 100644 --- a/plugins/guests/arch/cap/change_host_name.rb +++ b/plugins/guests/arch/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