From de9d38de21b04b869dcb4011ea372ad89fba8ab6 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 23 Nov 2013 13:25:33 -0800 Subject: [PATCH] core: don't load vagrantfile on plugin command --- CHANGELOG.md | 2 ++ bin/vagrant | 6 +++++- lib/vagrant/environment.rb | 12 ++++++------ 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c1fad071..82f01412d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,8 @@ BUG FIXES: - core: 100% CPU spike when waiting for SSH is fixed. [GH-2401] - core: Command lookup works on systems where PATH is not valid UTF-8 [GH-2514] - core: Human-friendly error if box metadata.json becomes corrupted. [GH-2305] + - core: Don't load Vagrantfile on `vagrant plugin` commands, allowing + Vagrantfiles that use plugins to work. [GH-2388] - guests/freebsd: Mounting NFS folders works. [GH-2400] - guests/freebsd: Uses `sh` by default for shell. [GH-2485] - guests/redhat: Down interface before messing up configuration file diff --git a/bin/vagrant b/bin/vagrant index de1e8b697..170527070 100755 --- a/bin/vagrant +++ b/bin/vagrant @@ -64,7 +64,11 @@ opts[:ui_class] ||= Vagrant::UI::Colored # of the plugin interface. ARGV.each do |arg| if !arg.start_with?("-") - ENV["VAGRANT_NO_PLUGINS"] = "1" if arg == "plugin" + if arg == "plugin" + ENV["VAGRANT_NO_PLUGINS"] = "1" + ENV["VAGRANT_VAGRANTFILE"] = "plugin_command_#{Time.now.to_i}" + end + break end end diff --git a/lib/vagrant/environment.rb b/lib/vagrant/environment.rb index 677d5c971..29e8f6ae8 100644 --- a/lib/vagrant/environment.rb +++ b/lib/vagrant/environment.rb @@ -62,12 +62,12 @@ module Vagrant # to the `Dir.pwd` (which is the cwd of the executing process). def initialize(opts=nil) opts = { - :cwd => nil, - :home_path => nil, - :local_data_path => nil, - :lock_path => nil, - :ui_class => nil, - :vagrantfile_name => nil + :cwd => nil, + :home_path => nil, + :local_data_path => nil, + :lock_path => nil, + :ui_class => nil, + :vagrantfile_name => nil, }.merge(opts || {}) # Set the default working directory to look for the vagrantfile