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/235e5988-c74d-4bcb-84eb-9e2ed285c1c4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to