Please review pull request #178: Fix recursion on kernel fact opened by (stschulte)
Description:
We encounter a recursion if we want to detect the kernel fact for the first
time:
The kernel codeblock calls
Facter::Util::Resolution.exec("uname -s")
and Facter::Util::Resolution#exec wants to detect if we can use which
to get the full path of the command. But the method
Facter::Util::Resolution#have_which tries to query the kernel fact again
to check if we are on windows.
Change the check in have_which so we dont have to query the kernel fact.
Diff follows:
diff --git a/lib/facter/util/resolution.rb b/lib/facter/util/resolution.rb
index a5f65c3..8b62957 100644
--- a/lib/facter/util/resolution.rb
+++ b/lib/facter/util/resolution.rb
@@ -15,7 +15,7 @@ class Facter::Util::Resolution
def self.have_which
if ! defined?(@have_which) or @have_which.nil?
- if Facter.value(:kernel) == 'windows'
+ if Facter::Util::Config.is_windows?
@have_which = false
else
%x{which which >/dev/null 2>&1}