Have a look at how the build in RPM provider works, for instance:
https://github.com/puppetlabs/puppet/blob/master/lib/puppet/provider/package/rpm.rb#L37
On Wednesday, March 18, 2015 at 2:46:05 PM UTC+11, Alex Harvey wrote:
>
> Can't you avoid this problem altogether by determining the PHP version in
> your custom provider code? Then you wouldn't need a custom fact at all,
> and in your manifest, have the custom type require the PHP package.
>
> On Monday, March 16, 2015 at 6:04:53 AM UTC+11, Jan S. wrote:
>>
>> Hello,
>>
>> I have the following use case: For a custom class/type I need to know
>> which php_version is installed on the machine. So I wrote a custom fact
>> like this:
>>
>> Facter.add('php_version') do
>> setcode do
>> Facter::Util::Resolution.exec('/usr/bin/php -i | /bin/egrep -e "^PHP
>> Version" | /usr/bin/head -n 1 | /usr/bin/cut -d " " -f 4 | /usr/bin/cut -d
>> "-" -f 1')
>> end
>> end
>>
>> It works great. Except: When php is not yet installed (there is a
>> Package['php'] definition, too). Then it will return an empty string.
>>
>> Thus I have to run puppet two times to get the expected result.
>>
>> I am sure that this is expected behavior of puppet. How do I handle such
>> case?
>>
>> Regards
>>
>> Jan
>>
>> --
>>
>> http://dracoblue.net
>>
>
--
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/814e2160-849a-455f-8af2-b372d24938e1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.