Clarified service logic logic for redhat flavors.

Signed-off-by: Ryan Davis <zenspider@chef.io>
This commit is contained in:
Ryan Davis 2020-01-23 16:04:40 -08:00
parent ad6ffcccd6
commit faf7833559

View file

@ -141,7 +141,11 @@ module Inspec::Resources
end
when "redhat", "fedora", "centos", "oracle", "cloudlinux"
version = os[:release].to_i
if (%w{redhat centos oracle cloudlinux}.include?(platform) && version >= 7) || (platform == "fedora" && version >= 15)
systemd = ((platform != "fedora" && version >= 7) ||
(platform == "fedora" && version >= 15))
if systemd
Systemd.new(inspec, service_ctl)
else
SysV.new(inspec, service_ctl || "/sbin/service")