Skip to content
This repository has been archived by the owner on Dec 2, 2020. It is now read-only.

Commit

Permalink
Merge pull request #60 from boxen/silence-not-installed
Browse files Browse the repository at this point in the history
java_version: silence if Java isn't installed.
  • Loading branch information
MikeMcQuaid committed Mar 12, 2015
2 parents 35f27ea + aedc3b9 commit afa4631
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/facter/java_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
# None
Facter.add(:java_version) do
setcode do
# This will fail on OS X when Java hasn't been installed yet.
next unless system "/usr/libexec/java_home --failfast &>/dev/null"
t_java = Facter::Util::Resolution.exec("java -version 2>&1")
java_version = t_java.to_s.lines.first.strip.split(/version/)[1].gsub(/"/, "").strip
end
end
end

0 comments on commit afa4631

Please sign in to comment.