Skip to content

Commit

Permalink
Merge pull request #14 from porvak/feature/add-jdk-8
Browse files Browse the repository at this point in the history
Adding support for JDK8
  • Loading branch information
tylerwalts committed Mar 24, 2014
2 parents 8687906 + f1c3017 commit 9531082
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Modulefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name 'tylerwalts-jdk_oracle'
version '1.1.0'
version '1.2.0'
source 'https://github.com/tylerwalts/puppet-jdk_oracle'
author 'tylerwalts'
license 'Apache License, Version 2.0'
summary 'Module for automating Oracle JDK download and installation'
description 'Module for automating Oracle JDK download and installation'
description 'Module for automating Oracle JDK download and installation, which does not have a dependency on a human download task, file share or centralized architecture design. It fetches the installer binary from the target server, for the target server. This approach assumes that automation is more valuable than bandwidth.'
project_page 'https://github.com/tylerwalts/puppet-jdk_oracle'
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ This approach was inspired by: http://stackoverflow.com/questions/10268583/how-t

Currently Supported:
* RedHat Family (RedHat, Fedora, CentOS)
* Java 6, 7
* Java 6, 7, 8

* This may work on other linux flavors but more testing is needed. Please seend feedback!

Expand Down
12 changes: 8 additions & 4 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,16 @@
}

case $version {
'8': {
$javaDownloadURI = "http://download.oracle.com/otn-pub/java/jdk/8-b132/jdk-8-linux-${plat_filename}.tar.gz"
$java_home = "${install_dir}/jdk1.8.0"
}
'7': {
$javaDownloadURI = "http://download.oracle.com/otn-pub/java/jdk/7/jdk-7-linux-${plat_filename}.tar.gz"
$java_home = "${install_dir}/jdk1.7.0"
}
'6': {
$javaDownloadURI = "http://download.oracle.com/otn-pub/java/jdk/6u45-b06/jdk-6u45-linux-${plat_filename}.bin"
$javaDownloadURI = "https://edelivery.oracle.com/otn-pub/java/jdk/6u45-b06/jdk-6u45-linux-${plat_filename}.bin"
$java_home = "${install_dir}/jdk1.6.0_45"
}
default: {
Expand All @@ -76,7 +80,7 @@
exec { 'get_jdk_installer':
cwd => $install_dir,
creates => "${install_dir}/${installerFilename}",
command => "wget -c --no-cookies --no-check-certificate --header \"Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com\" \"${javaDownloadURI}\" -O ${installerFilename}",
command => "wget -c --no-cookies --no-check-certificate --header \"Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com\" --header \"Cookie: oraclelicense=accept-securebackup-cookie\" \"${javaDownloadURI}\" -O ${installerFilename}",
timeout => 600,
require => Package['wget'],
}
Expand All @@ -86,8 +90,8 @@
}
}

# Java 7 comes in a tarball so just extract it.
if ( $version == '7' ) {
# Java 7/8 comes in a tarball so just extract it.
if ( $version in [ '7', '8' ] ) {
exec { 'extract_jdk':
cwd => "${install_dir}/",
command => "tar -xf ${installerFilename}",
Expand Down
19 changes: 19 additions & 0 deletions spec/classes/jdk_oracle_init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,25 @@
}
end

context 'specifying version 8' do
let :params do {
:version => '8',
} end

it {
should contain_exec( 'get_jdk_installer').with_creates('/opt/jdk-8-linux-x64.tar.gz')
should contain_file('/opt/jdk-8-linux-x64.tar.gz')
should contain_exec('extract_jdk').with_creates('/opt/jdk1.8.0')
should contain_file('/etc/alternatives/java').with({
:ensure => 'link',
:target => '/opt/jdk1.8.0/bin/java',
})
should contain_file('/opt/jdk-8').with({
:ensure => 'link',
})
}
end

context 'using custom installation directory' do
let :params do {
:install_dir => '/my/path',
Expand Down

0 comments on commit 9531082

Please sign in to comment.