I'm not sure you need a custom fact for this. Can you just check to see if, 
for example, Service['autofs']  or Service['autofs.service'] are defined?   

Bill


On Wednesday, February 21, 2018 at 5:00:06 PM UTC-5, Dennis Labkovich wrote:
>
> Hello,
>
> Trying to create a custom fact that will be created if there is existing 
> Linux service.
> I am using check for the file existence and it works. See below.
> But it looks like a better way would be using Puppet resource "service".
> If someone has idea on more elegant implementation, please, advise.
>
> Facter.add(:service_test) do
>         confine :osfamily => "RedHat"
>         setcode do
>                 if File.exist? '/etc/init.d/service_test'
>                 'service_test'
>                 end
>         end
> end
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/70ee1dcc-d1ce-464c-8f0c-6f3b4b1bf196%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to