mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 14:47:19 -04:00
A pack in this context is a *bundle* of plugins that can be distributed outside of rubygems; it is similar to what ES and kibana are doing, and the user interface is modeled after them. See https://www.elastic.co/downloads/x-pack **Do not mix it with the `bin/logstash-plugin pack/unpack` command.** - it contains one or more plugins that need to be installed - it is self-contains with the gems and the needed jars - it is distributed as a zip file - the file structure needs to follow some rules. - As a reserved name name on elastic.co download http server - `bin/plugin install logstash-mypack` will check on the download server if a pack for the current specific logstash version exist and it will be downloaded, if it doesn't exist we fallback on rubygems. - The file on the server will follow this convention `logstash-mypack-{LOGSTASH_VERSION}.zip` - As a fully qualified url - `bin/plugin install http://test.abc/logstash-mypack.zip`, if it exists it will be downloaded and installed if it does not we raise an error. - As a local file - `bin/plugin install file:///tmp/logstash-mypack.zip`, if it exists it will be installed Fixes #6168
28 lines
1.1 KiB
Ruby
28 lines
1.1 KiB
Ruby
# encoding: utf-8
|
|
require "pluginmanager/bundler/logstash_uninstall"
|
|
require "pluginmanager/command"
|
|
|
|
class LogStash::PluginManager::Remove < LogStash::PluginManager::Command
|
|
parameter "PLUGIN", "plugin name"
|
|
|
|
def execute
|
|
signal_error("File #{LogStash::Environment::GEMFILE_PATH} does not exist or is not writable, aborting") unless File.writable?(LogStash::Environment::GEMFILE_PATH)
|
|
|
|
##
|
|
# Need to setup the bundler status to enable uninstall of plugins
|
|
# installed as local_gems, otherwise gem:specification is not
|
|
# finding the plugins
|
|
##
|
|
LogStash::Bundler.setup!({:without => [:build, :development]})
|
|
|
|
# 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, aborting") unless LogStash::PluginManager.installed_plugin?(plugin, gemfile)
|
|
|
|
exit(1) unless ::Bundler::LogstashUninstall.uninstall!(plugin)
|
|
|
|
remove_unused_locally_installed_gems!
|
|
rescue => exception
|
|
report_exception("Operation aborted, cannot remove plugin.", exception)
|
|
end
|
|
end
|