core: Scaffold an action for persisting box information

This commit is contained in:
Fabio Rehm 2013-10-04 11:24:54 -03:00
parent 4fa12d896f
commit 670a441a99
2 changed files with 26 additions and 0 deletions

View File

@ -25,6 +25,7 @@ module Vagrant
autoload :SSHExec, "vagrant/action/builtin/ssh_exec" autoload :SSHExec, "vagrant/action/builtin/ssh_exec"
autoload :SSHRun, "vagrant/action/builtin/ssh_run" autoload :SSHRun, "vagrant/action/builtin/ssh_run"
autoload :WaitForCommunicator, "vagrant/action/builtin/wait_for_communicator" autoload :WaitForCommunicator, "vagrant/action/builtin/wait_for_communicator"
autoload :WriteBoxInfo, "vagrant/action/builtin/write_box_info"
end end
module General module General
@ -39,6 +40,7 @@ module Vagrant
def self.action_box_add def self.action_box_add
Builder.new.tap do |b| Builder.new.tap do |b|
b.use Builtin::BoxAdd b.use Builtin::BoxAdd
b.use Builtin::WriteBoxInfo
end end
end end
end end

View File

@ -0,0 +1,24 @@
require "log4r"
module Vagrant
module Action
module Builtin
# This middleware will persist some extra information about the base box
class WriteBoxInfo
def initialize(app, env)
@app = app
@logger = Log4r::Logger.new("vagrant::action::builtin::write_box_info")
end
def call(env)
box_url = env[:box_url]
box_added = env[:box_added]
# TODO: Persist box_url / provider / datetime
@app.call(env)
end
end
end
end
end