From 16ac4e2321f373bf83d7b058c9f2e0c649ffe96e Mon Sep 17 00:00:00 2001 From: Aneesh Agrawal Date: Sat, 9 May 2015 19:17:03 -0400 Subject: [PATCH] If plugins are disabled, report them as not available. Allows usage of VAGRANT_NO_PLUGINS env var to disable plugins. Fixes #5430. --- lib/vagrant.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/vagrant.rb b/lib/vagrant.rb index 1fb9c49d6..eba026c51 100644 --- a/lib/vagrant.rb +++ b/lib/vagrant.rb @@ -139,10 +139,12 @@ module Vagrant Config.run(version, &block) end - # This checks if a plugin with the given name is installed. This can - # be used from the Vagrantfile to easily branch based on plugin - # availability. + # This checks if a plugin with the given name is available (installed + # and enabled). This can be used from the Vagrantfile to easily branch + # based on plugin availability. def self.has_plugin?(name, version=nil) + return false unless Vagrant.plugins_enabled? + if !version # We check the plugin names first because those are cheaper to check return true if plugin("2").manager.registered.any? { |p| p.name == name }