Ensure provisioning executed after networking (#1480)

Provisioning is executed on the out-call action, so it should be added
the call start before the configuration of the network interfaces is
scheduled via a guest capability as it is also executed out the out call
to allow the first part to be performed before the VM is booted and the
latter to be done after it is running.

Fixes: #1479
This commit is contained in:
Darragh Bailey 2022-04-20 13:13:00 +01:00 committed by GitHub
parent 008e910856
commit e65aec6b0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -77,10 +77,12 @@ module VagrantPlugins
b.use BoxCheckOutdated b.use BoxCheckOutdated
b.use Call, IsCreated do |env, b2| b.use Call, IsCreated do |env, b2|
b2.use CleanupOnFailure b2.use CleanupOnFailure
b2.use Provision
# Create VM if not yet created. # Create VM if not yet created.
if !env[:result] if !env[:result]
b2.use SetNameOfDomain b2.use SetNameOfDomain
if !env[:machine].config.vm.box if !env[:machine].config.vm.box
b2.use CreateDomain b2.use CreateDomain
b2.use CreateNetworks b2.use CreateNetworks
@ -117,7 +119,7 @@ module VagrantPlugins
# Assuming VM is created, just start it. This action is not called # Assuming VM is created, just start it. This action is not called
# directly by any subcommand. VM can be suspended, already running or in # directly by any subcommand. VM can be suspended, already running or in
# poweroff state. # poweroff state.
def self.action_start private_class_method def self.action_start
Vagrant::Action::Builder.new.tap do |b| Vagrant::Action::Builder.new.tap do |b|
b.use ConfigValidate b.use ConfigValidate
b.use Call, IsRunning do |env, b2| b.use Call, IsRunning do |env, b2|
@ -140,8 +142,6 @@ module VagrantPlugins
b3.use StartDomain b3.use StartDomain
else else
# VM is not running or suspended. # VM is not running or suspended.
b3.use Provision
b3.use PrepareNFSValidIds b3.use PrepareNFSValidIds
b3.use SyncedFolderCleanup b3.use SyncedFolderCleanup
b3.use SyncedFolders b3.use SyncedFolders
@ -352,6 +352,8 @@ module VagrantPlugins
end end
b3.use CreateNetworks b3.use CreateNetworks
b3.use ResumeDomain b3.use ResumeDomain
b3.use Provision
b3.use WaitForCommunicator, [:running]
end end
end end
end end