Load config files (only) early so plugins are loaded from Vagrantfiles
This commit is contained in:
parent
3b735e545f
commit
f0294039e1
|
@ -5,6 +5,13 @@ require 'vagrant/cli'
|
|||
env = Vagrant::Environment.new
|
||||
|
||||
begin
|
||||
# Set the UI early in case any errors are raised, and load
|
||||
# the config immediately, so we gather any new commands from
|
||||
# plugins
|
||||
env.ui = Vagrant::UI::Shell.new(env, Thor::Base.shell.new)
|
||||
env.load!
|
||||
|
||||
# Kick start the CLI
|
||||
Vagrant::CLI.start(ARGV, :env => env)
|
||||
rescue Vagrant::Errors::VagrantError => e
|
||||
opts = { :_translate => false, :_prefix => false }
|
||||
|
|
|
@ -6,7 +6,6 @@ module Vagrant
|
|||
def initialize_environment(args, options, config)
|
||||
raise Errors::CLIMissingEnvironment.new if !config[:env]
|
||||
@env = config[:env]
|
||||
@env.ui = UI::Shell.new(@env, shell) if !@env.ui.is_a?(UI::Shell)
|
||||
end
|
||||
|
||||
# This returns an array of {VM} objects depending on the arguments
|
||||
|
|
|
@ -16,12 +16,6 @@ class CommandHelpersTest < Test::Unit::TestCase
|
|||
should "raise an exception if no environment is given" do
|
||||
assert_raises(Vagrant::Errors::CLIMissingEnvironment) { command([], nil) }
|
||||
end
|
||||
|
||||
should "not raise an exception if environment is given and setup UI" do
|
||||
env = vagrant_env
|
||||
assert_nothing_raised { command([], env) }
|
||||
assert env.ui.is_a?(Vagrant::UI::Shell)
|
||||
end
|
||||
end
|
||||
|
||||
context "vms from args" do
|
||||
|
|
Loading…
Reference in New Issue