Skip to content

Fix provisioning occurring before synced folders are fully mounted - #72

Open
Sn0wCrack wants to merge 4 commits into
letiemble:mainfrom
Sn0wCrack:fix/synced-folders-not-mounting-before-provision
Open

Fix provisioning occurring before synced folders are fully mounted#72
Sn0wCrack wants to merge 4 commits into
letiemble:mainfrom
Sn0wCrack:fix/synced-folders-not-mounting-before-provision

Conversation

@Sn0wCrack

@Sn0wCrack Sn0wCrack commented Dec 12, 2025

Copy link
Copy Markdown

Despite the way it seems, the builtin provision action should go before booting the VM as it internally waits until the VM is booted to continue[1], as does SyncedFolders[2].

This means you need to order the actions as: Provision -> SynecedFolders -> Boot, as Provision waits for Synced Folders, then Synced Folders waits for boot.

With the previous setup this resolved as Boot -> Provision -> SyncedFolders and now this resolves as Boot -> SyncedFolders -> Provision, which correctly allows usage of synced folders during provisioning.

Additionally I've fixed two other issues:

  • One issue where the VM will not be destroyed message that appears when declining to destroy an active VM displays an error instead.
  • One issue where the Hostname of the VM is not updated based on the Vagrantfile configuration.

Fixes #70

[1] https://github.com/hashicorp/vagrant/blob/e1c22285d2d650277990ca1a1c47ad8a1eb98eb9/lib/vagrant/action/builtin/provision.rb#L83
[2] https://github.com/hashicorp/vagrant/blob/e1c22285d2d650277990ca1a1c47ad8a1eb98eb9/lib/vagrant/action/builtin/synced_folders.rb#L89

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a critical issue where provisioning was occurring before synced folders were fully mounted. The fix reorders the action sequence so that Provision action (which internally waits for boot) comes before SyncedFolders action (which also waits for boot), ensuring synced folders are available during provisioning. Additionally, it introduces a new MessageWillNotDestroy action class to properly display a message when a user declines to destroy an active VM.

Key Changes

  • Reordered action sequence in action_start to move Provision before SyncedFolders and StartInstance
  • Added new MessageWillNotDestroy action class to handle the "will not destroy" message display
  • Added SetHostname action to the start sequence

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.

File Description
lib/vagrant-tart/action/message_will_not_destroy.rb New action class that displays a message when VM destruction is declined
lib/vagrant-tart/action.rb Reorders action sequence in action_start, adds MessageWillNotDestroy autoload, integrates the new action in action_destroy, and includes SetHostname in the start sequence

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/vagrant-tart/action/message_will_not_destroy.rb
Comment thread lib/vagrant-tart/action/message_will_not_destroy.rb
Comment thread lib/vagrant-tart/action/message_will_not_destroy.rb
Comment thread lib/vagrant-tart/action/message_will_not_destroy.rb Outdated
Comment thread lib/vagrant-tart/action.rb Outdated
Comment thread lib/vagrant-tart/action.rb
@@ -0,0 +1,20 @@
# Copyright (c) HashiCorp, Inc.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about this copyright. I have found a dozen of similar definition in various Vagrant providers....

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code is taken directly from the HashiCorp VirtualBox provider, which I believe is why they include this.

@letiemble

Copy link
Copy Markdown
Owner

Can you fix the build?

@Sn0wCrack

Copy link
Copy Markdown
Author

@letiemble That should be fixed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mount folders inside of Virtual Machine prior to running provision action

3 participants