Skip to content

Commit d5bbc7f

Browse files
committed
(538) - Unresolved fact fix
Prior to this commit, when run on non-darwin systems with no java installed, the custom fact java_version was unresolved. This was due to an incorrect return type set in lib/facter/java_version.rb (returned a boolean). This commit hopes to rectify this issue, by ensuring that the returned value for java_version is in the correct format.
1 parent 266957d commit d5bbc7f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/facter/java_version.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
Facter.add(:java_version) do
1717
setcode do
1818
if ['darwin'].include? Facter.value(:kernel).downcase
19-
return unless Facter::Core::Execution.execute('/usr/libexec/java_home --failfast', { on_fail: false })
19+
return nil unless Facter::Core::Execution.execute('/usr/libexec/java_home --failfast', { on_fail: false })
2020
else
21-
return unless Facter::Core::Execution.which('java')
21+
return nil unless Facter::Core::Execution.which('java')
2222
end
2323
version = Facter::Core::Execution.execute('java -Xmx12m -version 2>&1').lines.find { |line| line.include?('version') }
2424
version[%r{\"(.*?)\"}, 1] if version

0 commit comments

Comments
 (0)