Fix provisioning occurring before synced folders are fully mounted - #72
Fix provisioning occurring before synced folders are fully mounted#72Sn0wCrack wants to merge 4 commits into
Conversation
also fix issue where vm will not be destroyed message displays error
There was a problem hiding this comment.
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_startto moveProvisionbeforeSyncedFoldersandStartInstance - Added new
MessageWillNotDestroyaction class to handle the "will not destroy" message display - Added
SetHostnameaction 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.
| @@ -0,0 +1,20 @@ | |||
| # Copyright (c) HashiCorp, Inc. | |||
There was a problem hiding this comment.
Not sure about this copyright. I have found a dozen of similar definition in various Vagrant providers....
There was a problem hiding this comment.
This code is taken directly from the HashiCorp VirtualBox provider, which I believe is why they include this.
|
Can you fix the build? |
|
@letiemble That should be fixed now. |
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:
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