Class: SystemCheck::App::RedisVersionCheck

Inherits:
BaseCheck
  • Object
show all
Defined in:
lib/system_check/app/redis_version_check.rb

Constant Summary collapse

MIN_REDIS_VERSION =
'4.0.0'
'4.0.0'

Instance Attribute Summary

Attributes inherited from BaseCheck

#skip_reason

Instance Method Summary collapse

Methods inherited from BaseCheck

#can_repair?, #can_skip?, check_fail, check_pass, display_name, #multi_check, #multi_check?, #repair!, set_check_fail, set_check_pass, set_name, set_skip_reason, #skip?, skip_reason

Methods included from Helpers

#finished_checking, #fix_and_rerun, #for_more_information, #omnibus_gitlab?, #sanitized_message, #see_installation_guide_section, #should_sanitize?, #start_checking, #sudo_gitlab, #try_fixing_it

Methods included from Gitlab::TaskHelpers

#all_repos, #ask_to_continue, #checkout_or_clone_version, #checkout_version, #clone_repo, #get_version, #gid_for, #gitlab_user, #gitlab_user?, #invoke_and_time_task, #os_name, #prompt, #repository_storage_paths_args, #run_and_match, #run_command, #run_command!, #uid_for, #user_home, #warn_user_is_not_gitlab

Methods included from Gitlab::Utils::StrongMemoize

#clear_memoization, #strong_memoize, #strong_memoized?

Instance Method Details

#check?Boolean

Returns:

  • (Boolean)

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/system_check/app/redis_version_check.rb', line 14

def check?
  redis_version = Gitlab::Redis::Queues.with do |redis|
    redis.info['redis_version']
  end

  status = true

  if !redis_version
    @custom_error_message = "Could not retrieve the Redis version. Please check if your settings are correct"
    status = false
  elsif Gem::Version.new(redis_version) < Gem::Version.new(MIN_REDIS_VERSION)
    @custom_error_message = "Your Redis version #{redis_version} is not supported anymore. Update your Redis server to a version >= #{RECOMMENDED_REDIS_VERSION}"
    status = false
  elsif Gem::Version.new(redis_version) < Gem::Version.new(RECOMMENDED_REDIS_VERSION)
    @custom_error_message = "Support for your Redis version #{redis_version} has been deprecated and will be removed soon. Update your Redis server to a version >= #{RECOMMENDED_REDIS_VERSION}"
    status = false
  end

  status
end

#show_errorObject


35
36
37
38
39
40
41
42
43
# File 'lib/system_check/app/redis_version_check.rb', line 35

def show_error
  try_fixing_it(
    @custom_error_message
  )
  for_more_information(
    'doc/administration/high_availability/redis.md#provide-your-own-redis-instance'
  )
  fix_and_rerun
end