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 SaneDefaults
|
||||
b.use Customize
|
||||
b.use AfterCreate
|
||||
b.use Boot
|
||||
end
|
||||
end
|
||||
|
@ -86,7 +87,6 @@ module Vagrant
|
|||
end
|
||||
end
|
||||
b.use action_start
|
||||
b.use AfterCreate
|
||||
# b.use Vagrant::Action::Builtin::SetHostname
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,10 +3,11 @@ module Vagrant
|
|||
module Action
|
||||
class AfterCreate < BaseAction
|
||||
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'])
|
||||
env[:machine].provider.container.run_after_create_script script
|
||||
end
|
||||
@app.call env
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,10 +1,19 @@
|
|||
module Vagrant
|
||||
module LXC
|
||||
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
|
||||
def call(env)
|
||||
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
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue