Hi Jan,
Since your module installs PHP, you're kind of stuck with two runs,
unless you can provide some sane default when php_version is not
present. Suggest implementing your module such that PHP always gets
installed and whatever resources require that php_version be present are
wrapped in some conditional logic.
Here's a quick fix[1] to make your code faster and more portable and not
throw errors when PHP is not found. It does require that PHP be in your
$PATH.
Facter.add("php_version") do
setcode do
test_exists = "which php 2>&1 >/dev/null ; echo $?"
if Facter::Util::Resolution.exec(test_exists) == '0'
php_output = Facter::Util::Resolution.exec('php --version')
php_output.split[1]
end
end
end
[1] -
https://gist.github.com/ghoneycutt/42ab87c20f84ec422535
Best regards,
-g
--
Garrett Honeycutt
@learnpuppet
Puppet Training with LearnPuppet.com
Mobile:
+1.206.414.8658