From 8be99c43025b51189079e7cc335e0a621f2d9e4a Mon Sep 17 00:00:00 2001 From: Richard Pijnenburg Date: Fri, 7 Nov 2014 12:21:22 +0000 Subject: [PATCH] Force the uninstall of a plugin at install or update time. It can happen we want to update a plugin that is a dependency for an other plugin which will result in a warning and a manual action at uninstall phase of the install/update tasks Since we are 100% sure in these cases that the plugin will be installed again we can force the uninstall part not to alert us about it. This solves the issue we otherwise would get: Gem::DependencyRemovalException: Uninstallation aborted due to dependent gem(s) Fixes #2034 --- lib/logstash/pluginmanager/install.rb | 2 +- lib/logstash/pluginmanager/update.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/logstash/pluginmanager/install.rb b/lib/logstash/pluginmanager/install.rb index a1f1b8fa7..c7c1f15e7 100644 --- a/lib/logstash/pluginmanager/install.rb +++ b/lib/logstash/pluginmanager/install.rb @@ -49,7 +49,7 @@ class LogStash::PluginManager::Install < Clamp::Command puts ("removing existing plugin before installation") ::Gem.done_installing_hooks.clear - ::Gem::Uninstaller.new(gem_meta.name, {}).uninstall + ::Gem::Uninstaller.new(gem_meta.name, {:force => true}).uninstall end ::Gem.configuration.verbose = false diff --git a/lib/logstash/pluginmanager/update.rb b/lib/logstash/pluginmanager/update.rb index 081c09d11..4bf1c4e28 100644 --- a/lib/logstash/pluginmanager/update.rb +++ b/lib/logstash/pluginmanager/update.rb @@ -59,7 +59,7 @@ class LogStash::PluginManager::Update < Clamp::Command if LogStash::PluginManager::Util.installed?(spec.name) ::Gem.done_installing_hooks.clear - ::Gem::Uninstaller.new(gem_meta.name, {}).uninstall + ::Gem::Uninstaller.new(gem_meta.name, {:force => true}).uninstall end ::Gem.configuration.verbose = false