Hello,

I created a custom fact with the following procedure :

mkdir -p /etc/puppet/modules/facts/lib/facter
touch apache.rb

Content of apache.rb file :
Facter.add('apache') do
  setcode do
     apache_package = Facter::Core::Execution.exec('which apache2')

    # if 'which apache2' exits with an error, jruby_path will be an empty
string
    if apache_package == ""
      false
    else
      true
    end
  end
end

this is working when I use the $apache in templates, but when I do :
#facter apache

I got an empty answer.

How can I add the value to facter ?

Best regards,

Hugo

-- 
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/CAAoQnKjfmrVS75UNm3NT3Ch1nxiO%2BtE4qQM65D1fN94Pga-y%2Bg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to