mirror of
https://github.com/mastodon/mastodon.git
synced 2024-08-20 21:08:15 -07:00
Fix Elastic check deprecation warning about gem version (#27262)
This commit is contained in:
parent
85db392464
commit
2f8f92df48
1 changed files with 25 additions and 4 deletions
|
@ -76,14 +76,35 @@ class Admin::SystemCheck::ElasticsearchCheck < Admin::SystemCheck::BaseCheck
|
|||
end
|
||||
|
||||
def compatible_version?
|
||||
return false if running_version.nil?
|
||||
|
||||
Gem::Version.new(running_version) >= Gem::Version.new(required_version) ||
|
||||
Gem::Version.new(compatible_wire_version) >= Gem::Version.new(required_version)
|
||||
running_version_ok? || compatible_wire_version_ok?
|
||||
rescue ArgumentError
|
||||
false
|
||||
end
|
||||
|
||||
def running_version_ok?
|
||||
return false if running_version.blank?
|
||||
|
||||
gem_version_running >= gem_version_required
|
||||
end
|
||||
|
||||
def compatible_wire_version_ok?
|
||||
return false if compatible_wire_version.blank?
|
||||
|
||||
gem_version_compatible_wire >= gem_version_required
|
||||
end
|
||||
|
||||
def gem_version_running
|
||||
Gem::Version.new(running_version)
|
||||
end
|
||||
|
||||
def gem_version_required
|
||||
Gem::Version.new(required_version)
|
||||
end
|
||||
|
||||
def gem_version_compatible_wire
|
||||
Gem::Version.new(compatible_wire_version)
|
||||
end
|
||||
|
||||
def mismatched_indexes
|
||||
@mismatched_indexes ||= INDEXES.filter_map do |klass|
|
||||
klass.base_name if Chewy.client.indices.get_mapping[klass.index_name]&.deep_symbolize_keys != klass.mappings_hash
|
||||
|
|
Loading…
Reference in a new issue