Commit eb79e568 authored by Gabriel Mazetto's avatar Gabriel Mazetto

Refactored app/init script check to use dynamic skip reason

parent 706d49b2
...@@ -7,26 +7,22 @@ module SystemCheck ...@@ -7,26 +7,22 @@ module SystemCheck
set_skip_reason 'skipped (omnibus-gitlab has no init script)' set_skip_reason 'skipped (omnibus-gitlab has no init script)'
def skip? def skip?
omnibus_gitlab? return true if omnibus_gitlab?
end
def multi_check unless init_file_exists?
recipe_path = Rails.root.join('lib/support/init.d/', 'gitlab') self.skip_reason = "can't check because of previous errors"
unless File.exist?(SCRIPT_PATH) true
$stdout.puts "can't check because of previous errors".color(:magenta) end
return
end end
def check?
recipe_path = Rails.root.join('lib/support/init.d/', 'gitlab')
recipe_content = File.read(recipe_path) recipe_content = File.read(recipe_path)
script_content = File.read(SCRIPT_PATH) script_content = File.read(SCRIPT_PATH)
if recipe_content == script_content recipe_content == script_content
$stdout.puts 'yes'.color(:green)
else
$stdout.puts 'no'.color(:red)
show_error
end
end end
def show_error def show_error
...@@ -38,6 +34,12 @@ module SystemCheck ...@@ -38,6 +34,12 @@ module SystemCheck
) )
fix_and_rerun fix_and_rerun
end end
private
def init_file_exists?
File.exist?(SCRIPT_PATH)
end
end end
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment