mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 14:47:19 -04:00
Package elastic_integration
plugin. (#15769)
* Exclude plugins feature in OSS distributions. * Set elastic_integration plugin default. * Remove non-OSS plugins after installing default plugins. * Testing local can't find gem bundler (= 2.3.26) issue. * Include extract non-OSS plugins logic indocker build operations. * Only default plugins can be excluded from OSS distros. * Simplification: instead conditional check, use intersection to make OSS exlucluded plugin list. * Gem and specification files still stay after removing the plugin. This change removes the stayed files. * Rename oss-exclude to skip-oss to align namings with other params. * Make intersection method simpler. * [Test] Temporary excluding elastic integration plugin from default plugin list. * Sets elastic_integration plugin default back. When removing locally installed gems, Gem::Specification doesn't recognize the gem. We have Bundle::setup in the removal logic but it is causing an issue when we re-use the bundle. * Test the build order, remove plugin from cache logic seems invalid since we don't pack the cache.
This commit is contained in:
parent
22a10b5b92
commit
3c9db658bc
5 changed files with 58 additions and 20 deletions
|
@ -25,12 +25,7 @@ class LogStash::PluginManager::Remove < LogStash::PluginManager::Command
|
|||
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]})
|
||||
LogStash::Bundler.prepare({:without => [:build, :development]})
|
||||
|
||||
if LogStash::PluginManager::ALIASES.has_key?(plugin)
|
||||
unless LogStash::PluginManager.installed_plugin?(plugin, gemfile)
|
||||
|
@ -49,9 +44,22 @@ class LogStash::PluginManager::Remove < LogStash::PluginManager::Command
|
|||
signal_error("This plugin is already provided by '#{integration_plugin.name}' so it can't be removed individually")
|
||||
end
|
||||
|
||||
# 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)
|
||||
not_installed_message = "This plugin has not been previously installed"
|
||||
plugin_gem_spec = LogStash::PluginManager.find_plugins_gem_specs(plugin).any?
|
||||
if plugin_gem_spec
|
||||
# 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(not_installed_message) unless LogStash::PluginManager.installed_plugin?(plugin, gemfile)
|
||||
else
|
||||
# locally installed plugins are not recoginized by ::Gem::Specification
|
||||
# we may ::Bundler.setup to reload but it resets all dependencies so we get error message for future bundler operations
|
||||
# error message: `Bundler::GemNotFound: Could not find rubocop-1.60.2... in locally installed gems`
|
||||
# instead we make sure Gemfile has a definition and ::Gem::Specification recognizes local gem
|
||||
signal_error(not_installed_message) unless !!gemfile.find(plugin)
|
||||
|
||||
local_gem = gemfile.locally_installed_gems.detect { |local_gem| local_gem.name == plugin }
|
||||
signal_error(not_installed_message) unless local_gem
|
||||
end
|
||||
|
||||
exit(1) unless ::Bundler::LogstashUninstall.uninstall!(plugin)
|
||||
LogStash::Bundler.genericize_platform
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue