diff --git a/CHANGELOG.md b/CHANGELOG.md index dea7b712c..1da8dca7e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,7 +15,10 @@ IMPROVEMENTS: BUG FIXES: - - core/nfs: Exporting sub-directories of other exported folders now + - Boxes downloaded as part of `vagrant up` are now done so _prior_ to + config validation. This allows Vagrantfiles to references files that + may be in the box itself. [GH-1061] + - NFS synced folders exporting sub-directories of other exported folders now works properly. [GH-785] ## 1.2.3 (July 9, 2013) diff --git a/lib/vagrant/action/builtin/handle_box_url.rb b/lib/vagrant/action/builtin/handle_box_url.rb index 7cbac6570..5dbbf65fa 100644 --- a/lib/vagrant/action/builtin/handle_box_url.rb +++ b/lib/vagrant/action/builtin/handle_box_url.rb @@ -1,5 +1,7 @@ require "thread" +require "log4r" + module Vagrant module Action module Builtin @@ -13,9 +15,16 @@ module Vagrant def initialize(app, env) @app = app + @logger = Log4r::Logger.new("vagrant::action::builtin::handle_box_url") end def call(env) + if !env[:machine].config.vm.box || !env[:machine].config.vm.box_url + @logger.info("Skipping HandleBoxUrl because box or box_url not set.") + @app.call(env) + return + end + if !env[:machine].box # Get a "big lock" to make sure that our more fine grained # lock access is thread safe. diff --git a/plugins/providers/virtualbox/action.rb b/plugins/providers/virtualbox/action.rb index 513583d4e..972c5c8c4 100644 --- a/plugins/providers/virtualbox/action.rb +++ b/plugins/providers/virtualbox/action.rb @@ -293,12 +293,21 @@ module VagrantPlugins def self.action_up Vagrant::Action::Builder.new.tap do |b| b.use CheckVirtualbox + + # Handle box_url downloading early so that if the Vagrantfile + # references any files in the box or something it all just + # works fine. + b.use Call, Created do |env, b2| + if !env[:result] + b2.use HandleBoxUrl + end + end + b.use ConfigValidate b.use Call, Created do |env, b2| # If the VM is NOT created yet, then do the setup steps if !env[:result] b2.use CheckAccessible - b2.use HandleBoxUrl b2.use Import b2.use MatchMACAddress end