diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a26f39e1..3429ec02f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ ## 1.1.1 (unreleased) +IMPROVEMENTS: + + - Don't load plugins on any `vagrant plugin` command, so that errors + are avoided. [GH-1418] + BUG FIXES: - Quote keys to StringBlockEditor so keys with spaces, parens, and diff --git a/lib/vagrant.rb b/lib/vagrant.rb index 171167ae0..df29eb0bc 100644 --- a/lib/vagrant.rb +++ b/lib/vagrant.rb @@ -168,6 +168,12 @@ module Vagrant # # @param [String] name Name of the plugin to load. def self.require_plugin(name) + if ENV["VAGRANT_NO_PLUGINS"] + logger = Log4r::Logger.new("vagrant::root") + logger.warn("VAGRANT_NO_PLUGINS is set, not loading 3rd party plugin: #{name}") + return + end + # Redirect stdout/stderr so that we can output it in our own way. previous_stderr = $stderr previous_stdout = $stdout @@ -212,8 +218,8 @@ module Vagrant :plugin => name end ensure - $stderr = previous_stderr - $stdout = previous_stdout + $stderr = previous_stderr if previous_stderr + $stdout = previous_stdout if previous_stdout end end diff --git a/lib/vagrant/environment.rb b/lib/vagrant/environment.rb index 265a49141..979d7a143 100644 --- a/lib/vagrant/environment.rb +++ b/lib/vagrant/environment.rb @@ -631,13 +631,6 @@ module Vagrant # Loads the Vagrant plugins by properly setting up RubyGems so that # our private gem repository is on the path. def load_plugins - if ENV["VAGRANT_NO_PLUGINS"] - # If this key exists, then we don't load any plugins. It is a "safe - # mode" of sorts. - @logger.warn("VAGRANT_NO_PLUGINS is set. Not loading 3rd party plugins.") - return - end - # Add our private gem path to the gem path and reset the paths # that Rubygems knows about. ENV["GEM_PATH"] = "#{@gems_path}#{::File::PATH_SEPARATOR}#{ENV["GEM_PATH"]}"