diff --git a/lib/solr_wrapper.rb b/lib/solr_wrapper.rb index 12a4f27..4aa10e8 100644 --- a/lib/solr_wrapper.rb +++ b/lib/solr_wrapper.rb @@ -14,6 +14,11 @@ def self.default_solr_version 'latest' end + # A version we can fallback to if we can't retreive the latest + def self.fallback_solr_version + '6.6.0' + end + def self.default_solr_port '8983' end diff --git a/lib/solr_wrapper/configuration.rb b/lib/solr_wrapper/configuration.rb index b46d237..3e5ed0b 100644 --- a/lib/solr_wrapper/configuration.rb +++ b/lib/solr_wrapper/configuration.rb @@ -156,8 +156,11 @@ def default_configuration_paths end def fetch_latest_version - response = Faraday.get('https://svn.apache.org/repos/asf/lucene/cms/trunk/content/latestversion.mdtext') - response.body.strip + path = 'https://svn.apache.org/repos/asf/lucene/cms/trunk/content/latestversion.mdtext' + Faraday.get(path).body.strip + rescue Faraday::ConnectionFailed + $stderr.puts "Unable to connect to #{path} to retrieve the latest version. Using a default" + SolrWrapper.fallback_solr_version end end end