From 6c55a3a7920a5cc09ac940350ff45f11d70a5ee0 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Sat, 27 Jan 2024 14:19:36 +0100 Subject: [PATCH] Use heredoc now that we can count on Ruby 2.3+ --- lib/beaker/hypervisor/vagrant.rb | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/beaker/hypervisor/vagrant.rb b/lib/beaker/hypervisor/vagrant.rb index 6629a2e..2be30be 100644 --- a/lib/beaker/hypervisor/vagrant.rb +++ b/lib/beaker/hypervisor/vagrant.rb @@ -228,9 +228,8 @@ def provision(provider = nil) # make sure that any old boxes are dead dead dead begin vagrant_cmd('destroy --force') if File.file?(@vagrant_file) - rescue RuntimeError => e - # LATER: use <<~MESSAGE once we're on Ruby 2.3 - @logger.debug(%( + rescue + @logger.debug <<~MESSAGE Beaker failed to destroy the existing VM's. If you think this is an error or you upgraded from an older version of beaker try verifying the VM exists and deleting the existing Vagrantfile if @@ -240,8 +239,8 @@ def provision(provider = nil) vagrant status vagrant destroy # only need to run this is a VM is not created rm #{@vagrant_file} # only do this if all VM's are actually destroyed - ).each_line.map(&:strip).join("\n")) - raise e + MESSAGE + raise end make_vfile @hosts, @options