Skip to content
This repository has been archived by the owner on Dec 2, 2020. It is now read-only.

Upgrade to Java 8 #33

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![Build Status](https://travis-ci.org/boxen/puppet-java.png?branch=master)](https://travis-ci.org/boxen/puppet-java)

Installs Java 7 and unlimited key length security policy files..
Installs Java 8 and unlimited key length security policy files..


## Usage
Expand All @@ -14,17 +14,15 @@ include java

## Parameters

You can customise this module by configuring some optional class parameters. Usually you'd do this via Hiera, but you could also explicitly pass those parameters in puppet code like `class { 'java': update_version => '42', }`.
You can customise this module by configuring some optional class parameters. Usually you'd do this via Hiera, but you could also explicitly pass those parameters in puppet code like `class { 'java': update_version => '25', }`.

* `update_version`: The 'update' part of the JRE/JDK version to install. For example, if you specify `51`, the module would install java 7u51
* `base_download_url`: A base path from which the JRE and JDK packages should be downloaded. For example, if you specify `https://myorg.example/dist/java`, this module would download the jre from `https://myorg.example/dist/java/jre-7u51-macosx-x64.dmg`.
* `base_download_url`: A base path from which the JRE and JDK packages should be downloaded. For example, if you specify `https://myorg.example/dist/java`, this module would download the jre from `https://myorg.example/dist/java/jre-8u25-macosx-x64.dmg`.

All of these parameters have sensible defaults, and are provided if you need more control.

Example hiera data in YAML:

```yaml
java::update_version: '51'
java::base_download_url: 'https://myorg.example/dist/java'
```

Expand Down
Binary file modified files/US_export_policy.jar
Binary file not shown.
Binary file modified files/local_policy.jar
Binary file not shown.
16 changes: 8 additions & 8 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,30 @@
#
# include java
class java (
$update_version = '71',
$update_version = '25',
$base_download_url = 'https://s3.amazonaws.com/boxen-downloads/java'
) {
include boxen::config

$jre_url = "${base_download_url}/jre-7u${update_version}-macosx-x64.dmg"
$jdk_url = "${base_download_url}/jdk-7u${update_version}-macosx-x64.dmg"
$jre_url = "${base_download_url}/jre-8u${update_version}-macosx-x64.dmg"
$jdk_url = "${base_download_url}/jdk-8u${update_version}-macosx-x64.dmg"
$wrapper = "${boxen::config::bindir}/java"
$jdk_dir = "/Library/Java/JavaVirtualMachines/jdk1.7.0_${update_version}.jdk"
$jdk_dir = "/Library/Java/JavaVirtualMachines/jdk1.8.0_${update_version}.jdk"
$sec_dir = "${jdk_dir}/Contents/Home/jre/lib/security"

if ((versioncmp($::macosx_productversion_major, '10.10') >= 0) and
versioncmp($update_version, '71') < 0)
versioncmp($update_version, '20') < 0)
{
fail('Yosemite Requires Java 7 with a patch level >= 71 (Bug JDK-8027686)')
fail('Yosemite Requires Java 8 with a patch level >= 20 (Bug JDK-8027686)')
}

package {
"jre-7u${update_version}.dmg":
'jre-8.dmg':
ensure => present,
alias => 'java-jre',
provider => pkgdmg,
source => $jre_url ;
"jdk-7u${update_version}.dmg":
'jdk-8.dmg':
ensure => present,
alias => 'java',
provider => pkgdmg,
Expand Down
13 changes: 6 additions & 7 deletions spec/classes/java_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,25 @@
let(:facts) { default_test_facts }
let(:params) {
{
:update_version => '42',
:base_download_url => 'https://downloads.test/java'
}
}

it do
should contain_class('boxen::config')

should contain_package('jre-7u42.dmg').with({
should contain_package('jre-8.dmg').with({
:ensure => 'present',
:alias => 'java-jre',
:provider => 'pkgdmg',
:source => 'https://downloads.test/java/jre-7u42-macosx-x64.dmg'
:source => 'https://downloads.test/java/jre-8u25-macosx-x64.dmg'
})

should contain_package('jdk-7u42.dmg').with({
should contain_package('jdk-8.dmg').with({
:ensure => 'present',
:alias => 'java',
:provider => 'pkgdmg',
:source => 'https://downloads.test/java/jdk-7u42-macosx-x64.dmg'
:source => 'https://downloads.test/java/jdk-8u25-macosx-x64.dmg'
})

should contain_file('/test/boxen/bin/java').with({
Expand All @@ -37,13 +36,13 @@
let(:facts) { default_test_facts.merge({ :macosx_productversion_major => '10.10' }) }
let(:params) {
{
:update_version => '51',
:update_version => '5',
}
}
it do
expect {
should contain_class('java')
}.to raise_error(/Yosemite Requires Java 7 with a patch level >= 71 \(Bug JDK\-8027686\)/)
}.to raise_error(/Yosemite Requires Java 8 with a patch level >= 20 \(Bug JDK\-8027686\)/)
end
end
end