mirror of
https://github.com/inspec/inspec
synced 2024-11-14 00:47:10 +00:00
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:
parent
605f879429
commit
6fbd28c2bb
2 changed files with 4 additions and 4 deletions
|
@ -351,14 +351,15 @@ class Runit < ServiceManager
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# rubocop:disable Style/DoubleNegation
|
||||||
def info(service_name)
|
def info(service_name)
|
||||||
# get the status of runit service
|
# get the status of runit service
|
||||||
cmd = inspec.command("#{service_ctl} status #{service_name}")
|
cmd = inspec.command("#{service_ctl} status #{service_name}")
|
||||||
# return nil unless cmd.exit_status == 0 # NOTE(sr) why do we do this?
|
# return nil unless cmd.exit_status == 0 # NOTE(sr) why do we do this?
|
||||||
|
|
||||||
installed = cmd.exit_status == 0
|
installed = cmd.exit_status == 0
|
||||||
running = installed && (cmd.stdout =~ /^run:/)
|
running = installed && !!(cmd.stdout =~ /^run:/)
|
||||||
enabled = installed && (running || (cmd.stdout =~ /normally up/) || (cmd.stdout =~ /want up/))
|
enabled = installed && (running || !!(cmd.stdout =~ /normally up/) || !!(cmd.stdout =~ /want up/))
|
||||||
|
|
||||||
{
|
{
|
||||||
name: service_name,
|
name: service_name,
|
||||||
|
|
|
@ -1,3 +1,2 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
exec > /dev/null
|
exec tail -f /dev/null
|
||||||
exec yes
|
|
||||||
|
|
Loading…
Reference in a new issue