(MODULES-1570) java_patch_level fact

Uses the `java_version` fact and gets the patch level by splitting after `_`

This would be useful if you want to make sure you're not accidentally downgrading the version of Java to a lower patch level (I've noticed some package managers don't notice this too well)
This commit is contained in:
Peter Souter
2014-12-05 17:37:03 +00:00
parent 8724592f2b
commit ea4717ea29

View File

@@ -0,0 +1,22 @@
# Fact: java_patch_level
#
# Purpose: get Java's patch level
#
# Resolution:
# Uses java_version fact splits on the patch number (after _)
#
# Caveats:
# none
#
# Notes:
# None
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
end
end