Add warning if vagrant-triggers plugin is installed

To allow users to continue to use the community plugin, this commit adds
a switch that will not load the core trigger feature if it detects the
community plugin is installed. It also allows the user to disable the
warning so they can continue to use the plugin without extra output.
This commit is contained in:
Brian Cain 2018-04-26 10:47:28 -07:00
parent 2b13a6a608
commit 1ef45d8073
No known key found for this signature in database
GPG Key ID: 43D51080D357A001
2 changed files with 27 additions and 3 deletions

View File

@ -40,9 +40,28 @@ module VagrantPlugins
VMConfig VMConfig
end end
config("trigger") do plugins = Vagrant::Plugin::Manager.instance.installed_plugins
require File.expand_path("../config/trigger", __FILE__) if !plugins.keys.include?("vagrant-triggers")
TriggerConfig config("trigger") do
require File.expand_path("../config/trigger", __FILE__)
TriggerConfig
end
else
if !ENV["VAGRANT_USE_VAGRANT_TRIGGERS"]
$stderr.puts <<-EOF
WARNING: Vagrant has detected the `vagrant-triggers` plugin. This plugin conflicts
with the internal triggers implementation. Please uninstall the `vagrant-triggers`
plugin and run the command again if you wish to use the core trigger feature. To
uninstall the plugin, run the command shown below:
vagrant plugin uninstall vagrant-triggers
Note that the community plugin `vagrant-triggers` and the core trigger feature
in Vagrant do not have compatible syntax.
To disable this warning, set the environment variable `VAGRANT_USE_VAGRANT_TRIGGERS`.
EOF
end
end end
end end
end end

View File

@ -243,3 +243,8 @@ of PowerShell. Occasionally the default can be too low and Vagrant will report
being unable to detect the installed version of PowerShell. This environment being unable to detect the installed version of PowerShell. This environment
variable can be used to extend the timeout used during PowerShell version variable can be used to extend the timeout used during PowerShell version
detection. detection.
## `VAGRANT_USE_VAGRANT_TRIGGERS`
Vagrant will not display the warning about disabling the core trigger feature if
the community plugin is installed.