diff options
author | Douwe Maan <douwe@gitlab.com> | 2018-06-14 09:37:38 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2018-06-14 09:37:38 +0000 |
commit | 5694a00ec591077ee3d03d72ceb85d00d0603e6a (patch) | |
tree | c819da4a1e0f58f547e5becd2e575ccce2a698da | |
parent | cc553ed8f03dbbe88272ffe1a2b1bbb5b05f4489 (diff) | |
parent | 5240bb7574d3a5ee37904018ccb17fb635916afb (diff) | |
download | gitlab-ce-5694a00ec591077ee3d03d72ceb85d00d0603e6a.tar.gz |
Merge branch 'unify-simple_executor' into 'master'
Bring changes from EE for lib/system_check/simple_executor.rb
See merge request gitlab-org/gitlab-ce!19782
-rw-r--r-- | lib/system_check/simple_executor.rb | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/lib/system_check/simple_executor.rb b/lib/system_check/simple_executor.rb index d268f501b4a..99c9e984107 100644 --- a/lib/system_check/simple_executor.rb +++ b/lib/system_check/simple_executor.rb @@ -43,7 +43,7 @@ module SystemCheck # # @param [SystemCheck::BaseCheck] check_klass def run_check(check_klass) - $stdout.print "#{check_klass.display_name} ... " + print_display_name(check_klass) check = check_klass.new @@ -60,18 +60,18 @@ module SystemCheck end if check.check? - $stdout.puts check_klass.check_pass.color(:green) + print_check_pass(check_klass) else - $stdout.puts check_klass.check_fail.color(:red) + print_check_failure(check_klass) if check.can_repair? $stdout.print 'Trying to fix error automatically. ...' if check.repair! - $stdout.puts 'Success'.color(:green) + print_success return else - $stdout.puts 'Failed'.color(:red) + print_failure end end @@ -83,6 +83,26 @@ module SystemCheck private + def print_display_name(check_klass) + $stdout.print "#{check_klass.display_name} ... " + end + + def print_check_pass(check_klass) + $stdout.puts check_klass.check_pass.color(:green) + end + + def print_check_failure(check_klass) + $stdout.puts check_klass.check_fail.color(:red) + end + + def print_success + $stdout.puts 'Success'.color(:green) + end + + def print_failure + $stdout.puts 'Failed'.color(:red) + end + # Prints header content for the series of checks to be executed for this component # # @param [String] component name of the component relative to the checks being executed |