Refactored app/init script check to use dynamic skip reason

This commit is contained in:
Gabriel Mazetto 2017-09-04 03:59:37 +02:00
parent 706d49b259
commit eb79e5689e

View file

@ -7,26 +7,22 @@ module SystemCheck
set_skip_reason 'skipped (omnibus-gitlab has no init script)'
def skip?
omnibus_gitlab?
return true if omnibus_gitlab?
unless init_file_exists?
self.skip_reason = "can't check because of previous errors"
true
end
end
def multi_check
def check?
recipe_path = Rails.root.join('lib/support/init.d/', 'gitlab')
unless File.exist?(SCRIPT_PATH)
$stdout.puts "can't check because of previous errors".color(:magenta)
return
end
recipe_content = File.read(recipe_path)
script_content = File.read(SCRIPT_PATH)
if recipe_content == script_content
$stdout.puts 'yes'.color(:green)
else
$stdout.puts 'no'.color(:red)
show_error
end
recipe_content == script_content
end
def show_error
@ -38,6 +34,12 @@ module SystemCheck
)
fix_and_rerun
end
private
def init_file_exists?
File.exist?(SCRIPT_PATH)
end
end
end
end