mirror of
https://github.com/inspec/inspec
synced 2024-11-10 15:14:23 +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
|
||||
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,
|
||||
|
|
|
@ -1,3 +1,2 @@
|
|||
#!/bin/sh
|
||||
exec > /dev/null
|
||||
exec yes
|
||||
exec tail -f /dev/null
|
||||
|
|
Loading…
Reference in a new issue