Create custom fact for linux service

asked 2018-02-21 15:56:35 -0600

dlabko gravatar image


I am trying to create a custom fact for linux service. If service exists then custom fact is created. If service does not exist then pass. I am able to get this by using file existence check. But would like to see if better way is possible? Here is existing code.

Facter.add(:service_test) do confine :osfamily => "RedHat" setcode do if File.exist? '/etc/init.d/test' 'test' end end end

edit retag flag offensive close merge delete


there are a couple suggestions here: but i think checking for a files existence seems pretty resonable. what about checking the files existence do you see as problematic?

jason gravatar imagejason ( 2018-02-23 13:35:33 -0600 )edit