Don't load any plugins for `vagrant plugin` [GH-1418]

This commit is contained in:
Mitchell Hashimoto 2013-03-14 12:57:15 -07:00
parent c22e4fe19b
commit 327ca544ef
3 changed files with 13 additions and 9 deletions

View File

@ -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

View File

@ -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

View File

@ -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"]}"