Merge pull request #224 from vchepkov/java_version
[MODULES-4736] Increase Xmx setting for java_version fact
This commit is contained in:
@@ -23,7 +23,7 @@ Facter.add(:java_version) do
|
||||
setcode do
|
||||
unless [ 'openbsd', 'darwin' ].include? Facter.value(:operatingsystem).downcase
|
||||
if Facter::Util::Resolution.which('java')
|
||||
Facter::Util::Resolution.exec('java -Xmx8m -version 2>&1').lines.first.split(/"/)[1].strip
|
||||
Facter::Util::Resolution.exec('java -Xmx12m -version 2>&1').lines.first.split(/"/)[1].strip
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -35,7 +35,7 @@ Facter.add(:java_version) do
|
||||
setcode do
|
||||
Facter::Util::Resolution.with_env("PATH" => '/usr/local/jdk-1.7.0/jre/bin:/usr/local/jre-1.7.0/bin') do
|
||||
if Facter::Util::Resolution.which('java')
|
||||
Facter::Util::Resolution.exec('java -Xmx8m -version 2>&1').lines.first.split(/"/)[1].strip
|
||||
Facter::Util::Resolution.exec('java -Xmx12m -version 2>&1').lines.first.split(/"/)[1].strip
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -46,7 +46,7 @@ Facter.add(:java_version) do
|
||||
has_weight 100
|
||||
setcode do
|
||||
unless /Unable to find any JVMs matching version/ =~ Facter::Util::Resolution.exec('/usr/libexec/java_home --failfast 2>&1')
|
||||
Facter::Util::Resolution.exec('java -Xmx8m -version 2>&1').lines.first.split(/"/)[1].strip
|
||||
Facter::Util::Resolution.exec('java -Xmx12m -version 2>&1').lines.first.split(/"/)[1].strip
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -19,7 +19,7 @@ OpenJDK Runtime Environment (build 1.7.0_71-b14)
|
||||
OpenJDK 64-Bit Server VM (build 24.71-b01, mixed mode)
|
||||
EOS
|
||||
Facter::Util::Resolution.expects(:which).with("java").returns('/usr/local/jdk-1.7.0/jre/bin/java')
|
||||
Facter::Util::Resolution.expects(:exec).with("java -Xmx8m -version 2>&1").returns(java_version_output)
|
||||
Facter::Util::Resolution.expects(:exec).with("java -Xmx12m -version 2>&1").returns(java_version_output)
|
||||
expect(Facter.value(:java_version)).to eq("1.7.0_71")
|
||||
end
|
||||
end
|
||||
@@ -35,7 +35,7 @@ Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
|
||||
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)
|
||||
EOS
|
||||
Facter::Util::Resolution.expects(:exec).with("/usr/libexec/java_home --failfast 2>&1").returns("/Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home")
|
||||
Facter::Util::Resolution.expects(:exec).with("java -Xmx8m -version 2>&1").returns(java_version_output)
|
||||
Facter::Util::Resolution.expects(:exec).with("java -Xmx12m -version 2>&1").returns(java_version_output)
|
||||
expect(Facter.value(:java_version)).to eql "1.7.0_71"
|
||||
end
|
||||
end
|
||||
@@ -50,7 +50,7 @@ java version "1.7.0_71"
|
||||
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
|
||||
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)
|
||||
EOS
|
||||
Facter::Util::Resolution.expects(:exec).with("java -Xmx8m -version 2>&1").returns(java_version_output)
|
||||
Facter::Util::Resolution.expects(:exec).with("java -Xmx12m -version 2>&1").returns(java_version_output)
|
||||
expect(Facter.value(:java_version)).to eq("1.7.0_71")
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user