(MODULES-1570) Add java_major_version fact

Gives the major version of the Java release (ie. Java 1.7.0_71, major version is 7)

We also want to specifically return nil when java not present
This commit is contained in:
Peter Souter
2014-12-29 15:06:22 +00:00
committed by Peter Souter
parent 5168f61c26
commit cd3ac1ee46
6 changed files with 59 additions and 15 deletions

View File

@@ -13,10 +13,6 @@
Facter.add(:java_patch_level) do
setcode do
java_version = Facter.value(:java_version)
if java_version.nil?
"JAVA_NOT_INSTALLED"
else
java_patch_level = java_version.strip.split('_')[1]
end
java_patch_level = java_version.strip.split('_')[1] unless java_version.nil?
end
end