On Dec 9, 2010, at 7:14 AM, Martijn Grendelman wrote:

> I made a small mistake. Please see at the bottom.
> 
> On 09-12-10 15:30, Martijn Grendelman wrote:
>> An example: add the following to
>> 
>> <puppet_path>/modules/<modulename>/lib/facter/augeas_available.rb
>> 
>> -- cut here --
>> require 'facter'
>> 
>> Facter.add("augeas_available") do
>> 
>>    setcode do
>> 
>>        avail = "no"
>>        Dir.glob("/usr/lib/libaugeas*") { |filename|
>>                avail = "yes"
>>        }
>>        avail
>>    end
>> end
>> -- cut here --
>> 
>> It simple looks for files named /usr/lib/libaugeas*. I am not sure if that
>> is appropriate for CentOS too, but it works on Debian. Of course, this is
>> no guarantee that the Ruby-bindings are also available, so this is still
>> not idiot-proof.
>> 
>> After installing the fact, you can do something like this in a manifest:
>> 
>> if $augeas_availabe {
>> 
>>    augeas { "foo":
>>    }
>> 
>> }
> 
> Sorry, that should be:
> 
> if $augeas_availabe == "yes" {
> }
> 

I think this one might be better:
https://github.com/camptocamp/puppet-augeas/blob/master/lib/facter/augeasversion.rb

I think it will check if Augeas and the ruby bindings exist.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-us...@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to