logstash/lib/pluginmanager/install_strategy_factory.rb
Pier-Hugues Pellerin c98b4ee1df Do not try to reach the artifact server when no plugins is given
This PR fix an annoyance when running the `bin/logstash-plugin install
--no-verify` without any plugins, the command was making an unnecessary
call to the artifacts web server.

Fixes #6826
2017-03-26 20:44:07 -04:00

25 lines
739 B
Ruby

# encoding: utf-8
require "pluginmanager/ui"
require "pluginmanager/pack_fetch_strategy/repository"
require "pluginmanager/pack_fetch_strategy/uri"
module LogStash module PluginManager
class InstallStrategyFactory
AVAILABLES_STRATEGIES = [
LogStash::PluginManager::PackFetchStrategy::Uri,
LogStash::PluginManager::PackFetchStrategy::Repository
]
def self.create(plugins_args)
plugin_name_or_uri = plugins_args.first
return false if plugin_name_or_uri.nil? || plugin_name_or_uri.strip.empty?
AVAILABLES_STRATEGIES.each do |strategy|
if installer = strategy.get_installer_for(plugin_name_or_uri)
return installer
end
end
return false
end
end
end end