Merge pull request #11900 from soapy1/catch-guest-not-ready-sync-folder
Catch error for when guest is not available
This commit is contained in:
commit
0ee630feb4
@ -129,8 +129,14 @@ module Vagrant
|
||||
save_synced_folders(env[:machine], original_folders, **save_opts)
|
||||
end
|
||||
|
||||
# Persist the mounts by adding them to fstab
|
||||
if env[:machine].guest.capability?(:persist_mount_shared_folder)
|
||||
# Persist the mounts by adding them to fstab (only if the guest is available)
|
||||
begin
|
||||
persist_mount = env[:machine].guest.capability?(:persist_mount_shared_folder)
|
||||
rescue Errors::MachineGuestNotReady
|
||||
persist_mount = false
|
||||
end
|
||||
if persist_mount
|
||||
# Persist the mounts by adding them to fstab
|
||||
if env[:machine].config.vm.allow_fstab_modification
|
||||
fstab_folders = original_folders
|
||||
else
|
||||
|
||||
@ -255,5 +255,13 @@ describe Vagrant::Action::Builtin::SyncedFolders do
|
||||
subject.call(env)
|
||||
end
|
||||
end
|
||||
|
||||
context "when guest is not available" do
|
||||
it "does not persist folders if guest is not available" do
|
||||
allow(machine).to receive_message_chain(:guest, :capability?).and_raise(Vagrant::Errors::MachineGuestNotReady)
|
||||
expect(vm_config).to_not receive(:allow_fstab_modification)
|
||||
subject.call(env)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user