Commit f71fb8c3 authored by Alain Takoudjou's avatar Alain Takoudjou

fixup! NXD lib/tasks/gitlab/check: Exit with non-zero code, if something failed in a check task

Colorize gem was replaced with Rainbow, so we fix patched tasks check to work with the new module.
parent bacb76d2
require 'rainbow'
# if we ever print anything in red - that's an error
$check_failed = false
class String
alias_method :orig_color, :color
def color(code)
module Rainbow
module Ext
module String
module InstanceMethods
def color(*code)
if code == :red
$check_failed = true
end
orig_color(code)
Rainbow(self).foreground(*code)
end
end
end
end
end
......@@ -46,7 +53,6 @@ namespace :gitlab do
finished_checking "GitLab"
end
# Checks
########################
......@@ -149,7 +155,7 @@ namespace :gitlab do
def check_init_script_exists
print "Init script exists? ... "
puts 'skipped (slapos version has no init script)'.magenta
puts 'skipped (slapos version has no init script)'.color(:magenta)
return
if omnibus_gitlab?
......@@ -176,7 +182,7 @@ namespace :gitlab do
def check_init_script_up_to_date
print "Init script up-to-date? ... "
puts 'skipped (slapos version has no init script)'.magenta
puts 'skipped (slapos version has no init script)'.color(:magenta)
return
if omnibus_gitlab?
......@@ -884,7 +890,7 @@ namespace :gitlab do
def finished_checking(component)
puts ""
puts "Checking #{component.color(:yellow)} ... #{$check_failed ? "Failed"color(:red) : "OK".color(:green)}"
puts "Checking #{component.color(:yellow)} ... #{$check_failed ? "Failed".color(:red) : "OK".color(:green)}"
puts ""
exit 1 if $check_failed
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