OpenBSD doesn't have /etc/environment, therefore there is no

need to fiddle with it. The default case statement, "do nothing"
is all fine here.

Facter::Util::Resolution.with_env is long time gone since
Facter > 2.x. That was even longer before introduced by me.
Remove that OpenBSD special case in the java_version fact,
and assume that $PATH is properly set in order to find
the 'java' binary.

Additionally confine the java_default_home and java_libjvm_path
to OpenBSD kernel as well. Add some flesh to the java_default_home
fact to allow it to find the java binary.
This commit is contained in:
Sebastian Reitenbach
2017-09-25 12:05:00 +02:00
committed by Will Meek
parent db30eb9e2d
commit bdfc567c18
4 changed files with 14 additions and 21 deletions

View File

@@ -21,21 +21,7 @@ Facter.add(:java_version) do
# Additionally, facter versions prior to 2.0.1 only support
# positive matches, so this needs to be done manually in setcode.
setcode do
unless [ 'openbsd', 'darwin' ].include? Facter.value(:operatingsystem).downcase
version = nil
if Facter::Util::Resolution.which('java')
Facter::Util::Resolution.exec('java -Xmx12m -version 2>&1').lines.each { |line| version = $~[1] if /^.+ version \"(.+)\"$/ =~ line }
end
version
end
end
end
Facter.add(:java_version) do
confine :operatingsystem => 'OpenBSD'
has_weight 100
setcode do
Facter::Util::Resolution.with_env("PATH" => '/usr/local/jdk-1.7.0/jre/bin:/usr/local/jre-1.7.0/bin') do
unless [ 'darwin' ].include? Facter.value(:operatingsystem).downcase
version = nil
if Facter::Util::Resolution.which('java')
Facter::Util::Resolution.exec('java -Xmx12m -version 2>&1').lines.each { |line| version = $~[1] if /^.+ version \"(.+)\"$/ =~ line }