Fix issue with after create scripts
This commit is contained in:
parent
409ec9ecf4
commit
b9bb1dff1a
3 changed files with 13 additions and 3 deletions
|
@ -53,6 +53,7 @@ module Vagrant
|
||||||
b.use ForwardPorts
|
b.use ForwardPorts
|
||||||
b.use SaneDefaults
|
b.use SaneDefaults
|
||||||
b.use Customize
|
b.use Customize
|
||||||
|
b.use AfterCreate
|
||||||
b.use Boot
|
b.use Boot
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -86,7 +87,6 @@ module Vagrant
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
b.use action_start
|
b.use action_start
|
||||||
b.use AfterCreate
|
|
||||||
# b.use Vagrant::Action::Builtin::SetHostname
|
# b.use Vagrant::Action::Builtin::SetHostname
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,10 +3,11 @@ module Vagrant
|
||||||
module Action
|
module Action
|
||||||
class AfterCreate < BaseAction
|
class AfterCreate < BaseAction
|
||||||
def call(env)
|
def call(env)
|
||||||
|
# Continue, we need the VM to be booted.
|
||||||
|
@app.call env
|
||||||
if env[:just_created] && (script = env[:machine].box.metadata['after-create-script'])
|
if env[:just_created] && (script = env[:machine].box.metadata['after-create-script'])
|
||||||
env[:machine].provider.container.run_after_create_script script
|
env[:machine].provider.container.run_after_create_script script
|
||||||
end
|
end
|
||||||
@app.call env
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,10 +1,19 @@
|
||||||
module Vagrant
|
module Vagrant
|
||||||
module LXC
|
module LXC
|
||||||
module Action
|
module Action
|
||||||
|
# DISCUSS: The Boot action has a different meaning on VB provider and it
|
||||||
|
# assumes the machine has been started already.
|
||||||
class Boot < BaseAction
|
class Boot < BaseAction
|
||||||
def call(env)
|
def call(env)
|
||||||
config = env[:machine].provider_config
|
config = env[:machine].provider_config
|
||||||
env[:machine].provider.container.start(config)
|
|
||||||
|
# Allows this middleware to be called multiple times. We need to
|
||||||
|
# support this as base boxes might have after create scripts which
|
||||||
|
# require SSH access
|
||||||
|
unless env[:machine].state.running?
|
||||||
|
env[:machine].provider.container.start(config)
|
||||||
|
end
|
||||||
|
|
||||||
@app.call env
|
@app.call env
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue