box_url downloading happens before config validation [GH-1061]

This commit is contained in:
Mitchell Hashimoto 2013-07-10 20:10:33 -07:00
parent 3840e07adb
commit e941c549f2
3 changed files with 23 additions and 2 deletions

View File

@ -15,7 +15,10 @@ IMPROVEMENTS:
BUG FIXES: 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] works properly. [GH-785]
## 1.2.3 (July 9, 2013) ## 1.2.3 (July 9, 2013)

View File

@ -1,5 +1,7 @@
require "thread" require "thread"
require "log4r"
module Vagrant module Vagrant
module Action module Action
module Builtin module Builtin
@ -13,9 +15,16 @@ module Vagrant
def initialize(app, env) def initialize(app, env)
@app = app @app = app
@logger = Log4r::Logger.new("vagrant::action::builtin::handle_box_url")
end end
def call(env) 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 if !env[:machine].box
# Get a "big lock" to make sure that our more fine grained # Get a "big lock" to make sure that our more fine grained
# lock access is thread safe. # lock access is thread safe.

View File

@ -293,12 +293,21 @@ module VagrantPlugins
def self.action_up def self.action_up
Vagrant::Action::Builder.new.tap do |b| Vagrant::Action::Builder.new.tap do |b|
b.use CheckVirtualbox 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 ConfigValidate
b.use Call, Created do |env, b2| b.use Call, Created do |env, b2|
# If the VM is NOT created yet, then do the setup steps # If the VM is NOT created yet, then do the setup steps
if !env[:result] if !env[:result]
b2.use CheckAccessible b2.use CheckAccessible
b2.use HandleBoxUrl
b2.use Import b2.use Import
b2.use MatchMACAddress b2.use MatchMACAddress
end end