From 00418cc6585a52be26f461d26ab8b22f245af62d Mon Sep 17 00:00:00 2001 From: Omar Porras Date: Sun, 23 Mar 2014 22:15:25 -0500 Subject: [PATCH 1/2] Adding support for jdk8 --- manifests/init.pp | 8 ++++++-- spec/classes/jdk_oracle_init_spec.rb | 19 +++++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 9fc522d..4d5a9d4 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -46,6 +46,10 @@ } 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" @@ -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}", diff --git a/spec/classes/jdk_oracle_init_spec.rb b/spec/classes/jdk_oracle_init_spec.rb index 9592da9..a57cf18 100644 --- a/spec/classes/jdk_oracle_init_spec.rb +++ b/spec/classes/jdk_oracle_init_spec.rb @@ -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', From f1c30178bfed0c43d7d581b8c0d5c412f2e30ade Mon Sep 17 00:00:00 2001 From: Omar Porras Date: Sun, 23 Mar 2014 22:17:44 -0500 Subject: [PATCH 2/2] Added JDK8 to README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a44e221..7c5075f 100644 --- a/README.md +++ b/README.md @@ -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!