CFINSPEC-78: Add be_running matcher for the resource

Signed-off-by: Sonu Saha <sonu.saha@progress.com>
This commit is contained in:
Sonu Saha 2022-04-14 02:19:29 +05:30
parent bef163f75b
commit 117c9230e9

View file

@ -42,7 +42,12 @@ module Inspec::Resources
end end
def running? def running?
true auditctl_cmd = inspec.command("#{auditctl_utility} -s | grep pid")
raise Inspec::Exceptions::ResourceFailed, "Executing #{auditctl_utility} -s | grep enabled failed: #{auditctl_cmd.stderr}" if auditctl_cmd.exit_status.to_i != 0
auditctl_running_status = auditctl_cmd.stdout.strip.split
!auditctl_running_status[1].nil? && auditctl_running_status[1].to_i != 0
end end
def rules def rules