Add more specific rescue exceptions for when errors occur for resizing

disks
This commit is contained in:
Brian Cain 2020-02-12 16:26:18 -08:00
parent 42133ad34e
commit 625bbf9cc8
No known key found for this signature in database
GPG Key ID: 9FC4639B2E4510A0
2 changed files with 2 additions and 2 deletions

View File

@ -219,7 +219,7 @@ module VagrantPlugins
# clone back to original vmdk format and attach resized disk
vmdk_disk_file = machine.provider.driver.vdi_to_vmdk(vdi_disk_file)
machine.provider.driver.attach_disk(disk_info[:port], disk_info[:device], vmdk_disk_file, "hdd")
rescue Exception
rescue ScriptError, SignalException, StandardError
LOGGER.warn("Vagrant encountered an error while trying to resize a disk. Vagrant will now attempt to reattach and preserve the original disk...")
machine.ui.error(I18n.t("vagrant.cap.configure_disks.recovery_from_resize",

View File

@ -328,7 +328,7 @@ describe VagrantPlugins::ProviderVirtualBox::Cap::ConfigureDisks do
and_return(true)
expect(driver).to receive(:close_medium).with("12345")
allow(driver).to receive(:vdi_to_vmdk).and_raise(Exception)
allow(driver).to receive(:vdi_to_vmdk).and_raise(StandardError)
expect(FileUtils).to receive(:mv).with("#{vmdk_disk_file}.backup", vmdk_disk_file, force: true).
and_return(true)