Refactored app/init script check to use dynamic skip reason
This commit is contained in:
parent
706d49b259
commit
eb79e5689e
1 changed files with 15 additions and 13 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue