Merge branch 'do_not_depend_on_ctl_status' into 'master'

Use sv to check service status.

`gitlab-ctl status SERVICE` always returns 0 regardless of the actual status of the service.

Switch to using sv to check for the status.

Related to #748

See merge request !492
This commit is contained in:
Marin Jankovski 2015-09-28 15:25:09 +00:00
commit e7b00e4a5d
1 changed files with 9 additions and 3 deletions

View File

@ -25,6 +25,12 @@ module ShellOutHelper
o = Mixlib::ShellOut.new(cmd)
o.run_command
o
rescue Errno::EACCES
Chef::Log.info("Cannot execute #{cmd}.")
o
rescue Errno::ENOENT
Chef::Log.info("#{cmd} does not exist.")
o
end
def success?(cmd)
@ -34,7 +40,7 @@ module ShellOutHelper
def failure?(cmd)
o = do_shell_out(cmd)
o.exitstatus == 3
o.exitstatus != 0
end
end
@ -98,11 +104,11 @@ class OmnibusHelper
end
def self.service_up?(service_name)
success?("/opt/gitlab/bin/gitlab-ctl status #{service_name}")
success?("/opt/gitlab/embedded/bin/sv status #{service_name}")
end
def self.service_down?(service_name)
failure?("/opt/gitlab/bin/gitlab-ctl status #{service_name}")
failure?("/opt/gitlab/embedded/bin/sv status #{service_name}")
end
def self.user_exists?(username)