diff --git a/lib/vagrant/action.rb b/lib/vagrant/action.rb index 52164b462..8c8a241e0 100644 --- a/lib/vagrant/action.rb +++ b/lib/vagrant/action.rb @@ -25,6 +25,7 @@ module Vagrant autoload :SSHExec, "vagrant/action/builtin/ssh_exec" autoload :SSHRun, "vagrant/action/builtin/ssh_run" autoload :WaitForCommunicator, "vagrant/action/builtin/wait_for_communicator" + autoload :WriteBoxInfo, "vagrant/action/builtin/write_box_info" end module General @@ -39,6 +40,7 @@ module Vagrant def self.action_box_add Builder.new.tap do |b| b.use Builtin::BoxAdd + b.use Builtin::WriteBoxInfo end end end diff --git a/lib/vagrant/action/builtin/write_box_info.rb b/lib/vagrant/action/builtin/write_box_info.rb new file mode 100644 index 000000000..ebf11cfb9 --- /dev/null +++ b/lib/vagrant/action/builtin/write_box_info.rb @@ -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