Fix spurious admin dashboard warning when using ElasticSearch 7.x (#23064)
Some 7.x ElasticSearch versions support some 6.x nodes, thus the version check is inadequate. I am not sure there is a good way to check if a server implements all the 7.x APIs, so check server version and minimum wire version instead.
This commit is contained in:
parent
fcc4c9b34a
commit
41517a4845
1 changed files with 8 additions and 3 deletions
|
@ -30,19 +30,24 @@ class Admin::SystemCheck::ElasticsearchCheck < Admin::SystemCheck::BaseCheck
|
||||||
|
|
||||||
def running_version
|
def running_version
|
||||||
@running_version ||= begin
|
@running_version ||= begin
|
||||||
Chewy.client.info['version']['minimum_wire_compatibility_version'] ||
|
|
||||||
Chewy.client.info['version']['number']
|
Chewy.client.info['version']['number']
|
||||||
rescue Faraday::ConnectionFailed
|
rescue Faraday::ConnectionFailed
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def compatible_wire_version
|
||||||
|
Chewy.client.info['version']['minimum_wire_compatibility_version']
|
||||||
|
end
|
||||||
|
|
||||||
def required_version
|
def required_version
|
||||||
'7.x'
|
'7.x'
|
||||||
end
|
end
|
||||||
|
|
||||||
def compatible_version?
|
def compatible_version?
|
||||||
return false if running_version.nil?
|
return false if running_version.nil?
|
||||||
Gem::Version.new(running_version) >= Gem::Version.new(required_version)
|
|
||||||
|
Gem::Version.new(running_version) >= Gem::Version.new(required_version) ||
|
||||||
|
Gem::Version.new(compatible_wire_version) >= Gem::Version.new(required_version)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue