opening x-pack: make plugin install/remove error helpfully

Fixes #9239
This commit is contained in:
Ry Biesemeyer 2018-03-14 19:09:49 +00:00
parent d1cd17a15f
commit 256a6f748c
4 changed files with 66 additions and 0 deletions

View file

@ -1,5 +1,6 @@
# encoding: utf-8
require "pluginmanager/bundler/logstash_uninstall"
require "pluginmanager/x_pack_interceptor.rb"
require "pluginmanager/command"
class LogStash::PluginManager::Remove < LogStash::PluginManager::Command
@ -15,6 +16,10 @@ class LogStash::PluginManager::Remove < LogStash::PluginManager::Command
##
LogStash::Bundler.setup!({:without => [:build, :development]})
# If a user is attempting to uninstall X-Pack, present helpful output to guide
# them toward the OSS-only distribution of Logstash
LogStash::PluginManager::XPackInterceptor::Remove.intercept!(plugin)
# make sure this is an installed plugin and present in Gemfile.
# it is not possible to uninstall a dependency not listed in the Gemfile, for example a dependent codec
signal_error("This plugin has not been previously installed") unless LogStash::PluginManager.installed_plugin?(plugin, gemfile)