runit_service: fix resource, improve integration tests

Turns out using `/usr/bin/yes` to imitate a daemon process is a TERRIBLE idea.
This commit is contained in:
Stephan Renatus 2016-01-29 17:03:05 +01:00
parent 605f879429
commit 6fbd28c2bb
2 changed files with 4 additions and 4 deletions

View file

@ -351,14 +351,15 @@ class Runit < ServiceManager
super
end
# rubocop:disable Style/DoubleNegation
def info(service_name)
# get the status of runit service
cmd = inspec.command("#{service_ctl} status #{service_name}")
# return nil unless cmd.exit_status == 0 # NOTE(sr) why do we do this?
installed = cmd.exit_status == 0
running = installed && (cmd.stdout =~ /^run:/)
enabled = installed && (running || (cmd.stdout =~ /normally up/) || (cmd.stdout =~ /want up/))
running = installed && !!(cmd.stdout =~ /^run:/)
enabled = installed && (running || !!(cmd.stdout =~ /normally up/) || !!(cmd.stdout =~ /want up/))
{
name: service_name,

View file

@ -1,3 +1,2 @@
#!/bin/sh
exec > /dev/null
exec yes
exec tail -f /dev/null