summaryrefslogtreecommitdiff
path: root/lib/system_check
diff options
context:
space:
mode:
authorGabriel Mazetto <brodock@gmail.com>2017-09-04 03:59:37 +0200
committerGabriel Mazetto <brodock@gmail.com>2017-09-04 03:59:37 +0200
commiteb79e5689e15cde3e1f6902feb62953fd49df6ee (patch)
tree6cdd8914c0d179e36c9133081a8222657ee09e67 /lib/system_check
parent706d49b2590cfd70306f14cffdbadd237620a993 (diff)
downloadgitlab-ce-eb79e5689e15cde3e1f6902feb62953fd49df6ee.tar.gz
Refactored app/init script check to use dynamic skip reason
Diffstat (limited to 'lib/system_check')
-rw-r--r--lib/system_check/app/init_script_up_to_date_check.rb28
1 files changed, 15 insertions, 13 deletions
diff --git a/lib/system_check/app/init_script_up_to_date_check.rb b/lib/system_check/app/init_script_up_to_date_check.rb
index 015c7ed1731..53a47eb0f42 100644
--- a/lib/system_check/app/init_script_up_to_date_check.rb
+++ b/lib/system_check/app/init_script_up_to_date_check.rb
@@ -7,26 +7,22 @@ module SystemCheck
set_skip_reason 'skipped (omnibus-gitlab has no init script)'
def skip?
- omnibus_gitlab?
- end
+ return true if omnibus_gitlab?
- def multi_check
- recipe_path = Rails.root.join('lib/support/init.d/', 'gitlab')
+ unless init_file_exists?
+ self.skip_reason = "can't check because of previous errors"
- unless File.exist?(SCRIPT_PATH)
- $stdout.puts "can't check because of previous errors".color(:magenta)
- return
+ true
end
+ end
+
+ def check?
+ recipe_path = Rails.root.join('lib/support/init.d/', 'gitlab')
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