Add more specific rescue exceptions for when errors occur for resizing
disks
This commit is contained in:
parent
42133ad34e
commit
625bbf9cc8
@ -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",
|
||||
|
||||
@ -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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user