Skip to content

Commit

Permalink
Update java to 5b6470acf6ee284ed039e67703df63acb545e8a5
Browse files Browse the repository at this point in the history
5b6470acf6ee284ed039e67703df63acb545e8a5 Merge remote-tracking branch 'upstream/1.4.x'
4764484970d0b27d0daeaddce5d39527d27d21b7 Merge pull request redhat-openstack#117 from ccin2p3/f/libjvm_fact
9c154890a363be10a9ba6e09630f3c69008d670b add two facts: java_libjvm_path java_default_home
a65d69a85de13e75557e56151f82f0fb3207cc52 Merge pull request redhat-openstack#148 from tphoney/release_1.4.3
1c1d0b6cb7687ea0f4ca5074065635c4f3d0104a 1.4.3 release prep
4f0ee5a75975df27513ac257cca1f9278c4c2b7f Merge pull request redhat-openstack#147 from oc243/patch-2
ca2171043ee2f73c5e43c8adf59e72b52c91ebe2 Add support for Ubuntu 15.10
1236d9ee474da4ef342fae64e243998cf50678da Merge pull request redhat-openstack#145 from bmjen/git-fixtures
de05057e1d240dc7e68f79eefa15a628fcaca3b8 update fixtures.yml to use git instead of http

Change-Id: I3d3fddf66b94892672cf71f1926f775f6bef5aa4
  • Loading branch information
xbezdick committed Dec 15, 2015
1 parent 1d4940a commit 1ea9339
Show file tree
Hide file tree
Showing 9 changed files with 107 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Puppetfile
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ mod 'ironic',
:git => 'https://github.com/openstack/puppet-ironic.git'

mod 'java',
:commit => 'faede8c802c89ebe1f5e1a6c0f1b7b11d9cef996',
:commit => '5b6470acf6ee284ed039e67703df63acb545e8a5',
:git => 'http://github.com/puppetlabs/puppetlabs-java'

mod 'kafka',
Expand Down
5 changes: 5 additions & 0 deletions java/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## Supported Release 1.4.3
###Summary

Small release for support of newer PE versions. This increments the version of PE in the metadata.json file.

## 2015-10-07 - Supported Release 1.4.2
### Summary
This release fixes the fact to not trigger java every time on OS X when it is not available.
Expand Down
2 changes: 2 additions & 0 deletions java/README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ The java module includes a few facts to describe the version of Java installed o
* `java_major_version`: The major version of Java.
* `java_patch_level`: The patch level of Java.
* `java_version`: The full Java version string.
* `java_default_home`: The absolute path to the java system home directory (only available on Linux). For instance, the `java` executable's path would be `${::java_default_home}/jre/bin/java`. This is slightly different from the "standard" JAVA_HOME environment variable.
* `java_libjvm_path`: The absolute path to the directory containing the shared library `libjvm.so` (only available on Linux). Useful for setting `LD_LIBRARY_PATH` or configuring the dynamic linker.

**Note:** The facts return `nil` if Java is not installed on the system.

Expand Down
21 changes: 21 additions & 0 deletions java/lib/facter/java_default_home.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Fact: java_default_home
#
# Purpose: get absolute path of java system home
#
# Resolution:
# Uses `readlink` to resolve the path of `/usr/bin/java` then returns subsubdir
#
# Caveats:
# Requires readlink
#
# Notes:
# None
Facter.add(:java_default_home) do
confine :kernel => 'Linux'
setcode do
if Facter::Util::Resolution.which('readlink')
java_bin = Facter::Util::Resolution.exec('readlink -e /usr/bin/java').strip
java_default_home = File.dirname(File.dirname(File.dirname(java_bin)))
end
end
end
25 changes: 25 additions & 0 deletions java/lib/facter/java_libjvm_path.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Fact: java_libjvm_path
#
# Purpose: get path to libjvm.so
#
# Resolution:
# Lists file in java default home and searches for the file
#
# Caveats:
# Needs to list files recursively. Returns the first match
#
# Notes:
# None
Facter.add(:java_libjvm_path) do
confine :kernel => "Linux"
setcode do
java_default_home = Facter.value(:java_default_home)
java_libjvm_file = Dir.glob("#{java_default_home}/jre/lib/**/libjvm.so")
if java_libjvm_file.nil? || java_libjvm_file.empty?
nil
else
File.dirname(java_libjvm_file[0])
end
end
end

2 changes: 1 addition & 1 deletion java/manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
},
}
}
'vivid': {
'vivid', 'wily': {
$java = {
'jdk' => {
'package' => 'openjdk-8-jdk',
Expand Down
4 changes: 2 additions & 2 deletions java/metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "puppetlabs-java",
"version": "1.4.2",
"version": "1.4.3",
"author": "puppetlabs",
"summary": "Installs the correct Java package on various platforms.",
"license": "Apache-2.0",
Expand Down Expand Up @@ -78,7 +78,7 @@
"requirements": [
{
"name": "pe",
"version_requirement": ">= 3.0.0 < 2015.3.0"
"version_requirement": ">= 3.0.0 < 2015.4.0"
},
{
"name": "puppet",
Expand Down
29 changes: 29 additions & 0 deletions java/spec/unit/facter/java_default_home_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
require "spec_helper"

describe Facter::Util::Fact do
before {
Facter.clear
Facter.fact(:kernel).stubs(:value).returns('Linux')
}

describe "java_default_home" do
context 'returns java home path when readlink present' do
it do
java_path_output = <<-EOS
/usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java
EOS
Facter::Util::Resolution.expects(:which).with("readlink").returns(true)
Facter::Util::Resolution.expects(:exec).with("readlink -e /usr/bin/java").returns(java_path_output)
Facter.value(:java_default_home).should == "/usr/lib/jvm/java-7-openjdk-amd64"
end
end

context 'returns nil when readlink not present' do
it do
Facter::Util::Resolution.stubs(:exec)
Facter::Util::Resolution.expects(:which).with("readlink").at_least(1).returns(false)
Facter.value(:java_default_home).should be_nil
end
end
end
end
21 changes: 21 additions & 0 deletions java/spec/unit/facter/java_libjvm_path_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
require "spec_helper"

describe Facter::Util::Fact do
before {
Facter.clear
Facter.fact(:kernel).stubs(:value).returns('Linux')
java_default_home = '/usr/lib/jvm/java-8-openjdk-amd64'
Facter.fact(:java_default_home).stubs(:value).returns(java_default_home)
Dir.stubs(:glob).with("#{java_default_home}/jre/lib/**/libjvm.so").returns( ['/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server/libjvm.so'])
}

describe "java_libjvm_path" do
context 'returns libjvm path' do
context 'on Linux' do
it do
Facter.value(:java_libjvm_path).should == "/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server"
end
end
end
end
end

0 comments on commit 1ea9339

Please sign in to comment.