(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:
22
lib/facter/java_patch_level.rb
Normal file
22
lib/facter/java_patch_level.rb
Normal 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
|
||||
Reference in New Issue
Block a user