From e0b0e1cd194750ea98dc931ed4e8f99d23144699 Mon Sep 17 00:00:00 2001 From: Paula Muir Date: Fri, 24 Aug 2018 09:15:08 +0100 Subject: [PATCH 01/17] (MODULES-7705) - Bumping stdlib requirement to 6.0.0 --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 7d5bccb..dc1126d 100644 --- a/metadata.json +++ b/metadata.json @@ -10,7 +10,7 @@ "dependencies": [ { "name": "puppetlabs/stdlib", - "version_requirement": ">= 4.13.1 < 5.0.0" + "version_requirement": ">= 4.13.1 < 6.0.0" }, { "name": "puppet/archive", From 01b95d32c62a20b4115e85b9bc01c8306c348910 Mon Sep 17 00:00:00 2001 From: tphoney Date: Thu, 30 Aug 2018 17:07:43 +0100 Subject: [PATCH 02/17] (MODULES-7658) use beaker4 in puppet-module-gems --- spec/spec_helper_acceptance.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 25d7ce0..0bda578 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -1,8 +1,11 @@ +require 'beaker-pe' +require 'beaker-puppet' require 'beaker-rspec' require 'beaker/puppet_install_helper' require 'beaker/module_install_helper' run_puppet_install_helper +configure_type_defaults_on(hosts) install_module_on(hosts) install_module_dependencies_on(hosts) From a24f8f15ea414ed96f4855e30541d467717d9ffd Mon Sep 17 00:00:00 2001 From: David Swan Date: Thu, 6 Sep 2018 16:21:26 +0100 Subject: [PATCH 03/17] 3.1.0 Pre Release --- CHANGELOG.md | 8 ++++++++ metadata.json | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d905ea4..39ecabc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,14 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org). +## [3.1.0](https://github.com/puppetlabs/puppetlabs-java/tree/3.1.0) (2018-09-06) + +[Full Changelog](https://github.com/puppetlabs/puppetlabs-java/compare/3.0.0...3.1.0) + +### Added + +- pdksync - \(MODULES-7705\) - Bumping stdlib dependency from \< 5.0.0 to \< 6.0.0 [\#310](https://github.com/puppetlabs/puppetlabs-java/pull/310) ([pmcmaw](https://github.com/pmcmaw)) + ## [3.0.0](https://github.com/puppetlabs/puppetlabs-java/tree/3.0.0) (2018-08-13) [Full Changelog](https://github.com/puppetlabs/puppetlabs-java/compare/2.4.0...3.0.0) diff --git a/metadata.json b/metadata.json index dc1126d..10ebd5e 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppetlabs-java", - "version": "3.0.0", + "version": "3.1.0", "author": "puppetlabs", "summary": "Installs the correct Java package on various platforms.", "license": "Apache-2.0", From 728fc7e02d0879617305da19d3c79e0b1944f3f9 Mon Sep 17 00:00:00 2001 From: olevole Date: Thu, 20 Sep 2018 14:22:37 +0300 Subject: [PATCH 04/17] fix set JAVA_HOME environments on FreeBSD platform FreeBSD do not use /etc/environment file for global variables. Instead we use two places to set the variable: - /etc/profile for sh(1) - /etc/csh.login for csh(1) which is the default shell for FreeBSD Fixes for MODULES-7819 issue --- manifests/config.pp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/manifests/config.pp b/manifests/config.pp index 6237a8b..623b121 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -44,7 +44,7 @@ class java::config ( ) { } } } - 'FreeBSD', 'Suse': { + 'Suse': { if $java::use_java_home != undef { file_line { 'java-home-environment': path => '/etc/environment', @@ -53,6 +53,20 @@ class java::config ( ) { } } } + 'FreeBSD': { + if $java::use_java_home != undef { + file_line { 'java-home-environment-profile': + path => '/etc/profile', + line => "JAVA_HOME=${$java::use_java_home}; export JAVA_HOME", + match => 'JAVA_HOME=', + } + file_line { 'java-home-environment-cshrc': + path => '/etc/csh.login', + line => "setenv JAVA_HOME ${$java::use_java_home}", + match => 'setenv JAVA_HOME', + } + } + } 'Solaris': { if $java::use_java_home != undef { file_line { 'java-home-environment': From a63f78839458b5ab8376e32dbe4ba7a4984088ee Mon Sep 17 00:00:00 2001 From: tphoney Date: Thu, 20 Sep 2018 16:33:43 +0100 Subject: [PATCH 05/17] (MODULES-6805) metadata.json shows support for puppet 6 --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 10ebd5e..52f1218 100644 --- a/metadata.json +++ b/metadata.json @@ -84,7 +84,7 @@ "requirements": [ { "name": "puppet", - "version_requirement": ">= 4.7.0 < 6.0.0" + "version_requirement": ">= 4.7.0 < 7.0.0" } ], "template-url": "https://github.com/puppetlabs/pdk-templates", From 2926bbcfcb8f80c4aba9c4c9d25096d97503827b Mon Sep 17 00:00:00 2001 From: Paula Muir Date: Mon, 24 Sep 2018 17:02:26 +0100 Subject: [PATCH 06/17] (FM-7392) - Puppet 6 Testing Changes --- .rubocop.yml | 4 ++++ .travis.yml | 15 +++++++++------ Gemfile | 22 +++++++--------------- metadata.json | 2 +- spec/default_facts.yml | 2 +- 5 files changed, 22 insertions(+), 23 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 54d1597..f5a6c2a 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -19,6 +19,10 @@ AllCops: Metrics/LineLength: Description: People have wide screens, use them. Max: 200 +GetText/DecorateString: + Description: We don't want to decorate test output. + Exclude: + - spec/* RSpec/BeforeAfterAll: Description: Beware of using after(:all) as it may cause state to leak between tests. A necessary evil in acceptance testing. diff --git a/.travis.yml b/.travis.yml index 4208b9e..e861e35 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,26 +13,26 @@ script: - 'bundle exec rake $CHECK' bundler_args: --without system_tests rvm: - - 2.4.4 + - 2.5.0 env: global: - - BEAKER_PUPPET_COLLECTION=puppet5 PUPPET_GEM_VERSION="~> 5.0" + - BEAKER_PUPPET_COLLECTION=puppet6 PUPPET_GEM_VERSION="~> 6.0" matrix: fast_finish: true include: - bundler_args: dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_set=docker/centos-7 BEAKER_TESTMODE=apply - rvm: 2.4.4 + env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_set=docker/centos-7 BEAKER_TESTMODE=apply + rvm: 2.5.0 script: bundle exec rake beaker services: docker sudo: required - bundler_args: dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_set=docker/ubuntu-14.04 BEAKER_TESTMODE=apply - rvm: 2.4.4 + env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_set=docker/ubuntu-14.04 BEAKER_TESTMODE=apply + rvm: 2.5.0 script: bundle exec rake beaker services: docker sudo: required @@ -40,6 +40,9 @@ matrix: env: CHECK="syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop" - env: CHECK=parallel_spec + - + env: PUPPET_GEM_VERSION="~> 5.0" CHECK=parallel_spec + rvm: 2.4.4 - env: PUPPET_GEM_VERSION="~> 4.0" CHECK=parallel_spec rvm: 2.1.9 diff --git a/Gemfile b/Gemfile index 05cb6e6..47fa24e 100644 --- a/Gemfile +++ b/Gemfile @@ -1,25 +1,18 @@ source ENV['GEM_SOURCE'] || 'https://rubygems.org' def location_for(place_or_version, fake_version = nil) - if place_or_version =~ %r{\A(git[:@][^#]*)#(.*)} - [fake_version, { git: Regexp.last_match(1), branch: Regexp.last_match(2), require: false }].compact - elsif place_or_version =~ %r{\Afile:\/\/(.*)} - ['>= 0', { path: File.expand_path(Regexp.last_match(1)), require: false }] + git_url_regex = %r{\A(?(https?|git)[:@][^#]*)(#(?.*))?} + file_url_regex = %r{\Afile:\/\/(?.*)} + + if place_or_version && (git_url = place_or_version.match(git_url_regex)) + [fake_version, { git: git_url[:url], branch: git_url[:branch], require: false }].compact + elsif place_or_version && (file_url = place_or_version.match(file_url_regex)) + ['>= 0', { path: File.expand_path(file_url[:path]), require: false }] else [place_or_version, { require: false }] end end -def gem_type(place_or_version) - if place_or_version =~ %r{\Agit[:@]} - :git - elsif !place_or_version.nil? && place_or_version.start_with?('file:') - :file - else - :gem - end -end - ruby_version_segments = Gem::Version.new(RUBY_VERSION.dup).segments minor_version = ruby_version_segments[0..1].join('.') @@ -41,7 +34,6 @@ group :system_tests do end puppet_version = ENV['PUPPET_GEM_VERSION'] -puppet_type = gem_type(puppet_version) facter_version = ENV['FACTER_GEM_VERSION'] hiera_version = ENV['HIERA_GEM_VERSION'] diff --git a/metadata.json b/metadata.json index 10ebd5e..88a16d7 100644 --- a/metadata.json +++ b/metadata.json @@ -88,6 +88,6 @@ } ], "template-url": "https://github.com/puppetlabs/pdk-templates", - "template-ref": "1.7.0-0-g57412ed", + "template-ref": "heads/master-0-g8fc95db", "pdk-version": "1.7.0" } diff --git a/spec/default_facts.yml b/spec/default_facts.yml index 3248be5..e10d991 100644 --- a/spec/default_facts.yml +++ b/spec/default_facts.yml @@ -2,7 +2,7 @@ # # Facts specified here will override the values provided by rspec-puppet-facts. --- -concat_basedir: "/tmp" +concat_basedir: "" ipaddress: "172.16.254.254" is_pe: false macaddress: "AA:AA:AA:AA:AA:AA" From 1b56da5a271c0c349f4938bc4fa35fe79f0448b9 Mon Sep 17 00:00:00 2001 From: David Swan Date: Thu, 27 Sep 2018 11:35:12 +0100 Subject: [PATCH 07/17] (MODULES-7898) - 3.2.0 Release Prep --- CHANGELOG.md | 8 ++++++++ metadata.json | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 39ecabc..7153f3e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,14 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org). +## [3.2.0](https://github.com/puppetlabs/puppetlabs-java/tree/3.2.0) (2018-09-27) + +[Full Changelog](https://github.com/puppetlabs/puppetlabs-java/compare/3.1.0...3.2.0) + +### Added + +- pdksync - \(MODULES-6805\) metadata.json shows support for puppet 6 [\#317](https://github.com/puppetlabs/puppetlabs-java/pull/317) ([tphoney](https://github.com/tphoney)) + ## [3.1.0](https://github.com/puppetlabs/puppetlabs-java/tree/3.1.0) (2018-09-06) [Full Changelog](https://github.com/puppetlabs/puppetlabs-java/compare/3.0.0...3.1.0) diff --git a/metadata.json b/metadata.json index 9c62c4d..8d4da5f 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppetlabs-java", - "version": "3.1.0", + "version": "3.2.0", "author": "puppetlabs", "summary": "Installs the correct Java package on various platforms.", "license": "Apache-2.0", From 60c93866b1a6132c2d02ef1b75027fe51a217b5e Mon Sep 17 00:00:00 2001 From: Matthias Baur Date: Mon, 1 Oct 2018 18:07:32 +0200 Subject: [PATCH 08/17] (MODULES-8025) Switch default for Ubuntu 18.04 to 11 This is needed to get the default Java version rollout with Ubuntu 18.04. --- manifests/params.pp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/manifests/params.pp b/manifests/params.pp index e302bca..e69a19d 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -155,7 +155,7 @@ class java::params { }, } } - 'stretch', 'vivid', 'wily', 'xenial', 'yakkety', 'zesty', 'artful', 'bionic': { + 'stretch', 'vivid', 'wily', 'xenial', 'yakkety', 'zesty', 'artful': { $java = { 'jdk' => { 'package' => 'openjdk-8-jdk', @@ -171,6 +171,22 @@ class java::params { } } } + 'bionic': { + $java = { + 'jdk' => { + 'package' => 'openjdk-11-jdk', + 'alternative' => "java-1.11.0-openjdk-${::architecture}", + 'alternative_path' => "/usr/lib/jvm/java-1.11.0-openjdk-${::architecture}/bin/java", + 'java_home' => "/usr/lib/jvm/java-1.11.0-openjdk-${::architecture}/", + }, + 'jre' => { + 'package' => 'openjdk-11-jre-headless', + 'alternative' => "java-1.11.0-openjdk-${::architecture}", + 'alternative_path' => "/usr/lib/jvm/java-1.11.0-openjdk-${::architecture}/bin/java", + 'java_home' => "/usr/lib/jvm/java-1.11.0-openjdk-${::architecture}/", + } + } + } default: { fail("unsupported release ${::lsbdistcodename}") } } } From 89aa846909a4e9871559724358e824e0549d9a37 Mon Sep 17 00:00:00 2001 From: Eimhin Laverty Date: Wed, 3 Oct 2018 15:20:48 +0100 Subject: [PATCH 09/17] (MODULES-7050) - Fix OracleJDK reinstalling on Puppet runs --- manifests/oracle.pp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/manifests/oracle.pp b/manifests/oracle.pp index cf97e6c..36313b8 100644 --- a/manifests/oracle.pp +++ b/manifests/oracle.pp @@ -119,7 +119,13 @@ define java::oracle ( $release_hash = $url_hash if $release_major =~ /(\d+)u(\d+)/ { - $install_path = "${java_se}1.${1}.0_${2}" + # Required for CentOS systems where Java8 update number is >= 171 to ensure + # the package is visible to Puppet + if $facts['os']['name'] == 'CentOS' and $2 >= '171' { + $install_path = "${java_se}1.${1}.0_${2}-amd64" + } else { + $install_path = "${java_se}1.${1}.0_${2}" + } } else { $install_path = "${java_se}${release_major}${release_minor}" } From 5f1b7ecea84661bc7601c7bf0761a2836473f8b4 Mon Sep 17 00:00:00 2001 From: Dennis Ploeger Date: Fri, 12 Oct 2018 07:43:57 +0200 Subject: [PATCH 10/17] Optimized code for making java::oracle atomic. Fixes MODULES-8085 --- manifests/oracle.pp | 24 +++--- spec/defines/oracle_spec.rb | 156 +++++++++++++++++++++++++++--------- 2 files changed, 133 insertions(+), 47 deletions(-) diff --git a/manifests/oracle.pp b/manifests/oracle.pp index 36313b8..38a9ff6 100644 --- a/manifests/oracle.pp +++ b/manifests/oracle.pp @@ -269,20 +269,22 @@ define java::oracle ( } case $facts['kernel'] { 'Linux' : { - exec { "Install Oracle java_se ${java_se} ${version}" : + case $facts['os']['family'] { + 'Debian' : { + ensure_resource('file', '/usr/lib/jvm', { + ensure => directory, + }) + $install_requires = [Archive[$destination], File['/usr/lib/jvm']] + } + default : { + $install_requires = [Archive[$destination]] + } + } + exec { "Install Oracle java_se ${java_se} ${version} ${release_major} ${release_minor}" : path => '/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin', command => $install_command, creates => $creates_path, - require => Archive[$destination] - } - case $facts['os']['family'] { - 'Debian' : { - file{'/usr/lib/jvm': - ensure => directory, - before => Exec["Install Oracle java_se ${java_se} ${version}"] - } - } - default : { } + require => $install_requires } } default : { diff --git a/spec/defines/oracle_spec.rb b/spec/defines/oracle_spec.rb index afa85cf..3674b76 100644 --- a/spec/defines/oracle_spec.rb +++ b/spec/defines/oracle_spec.rb @@ -11,8 +11,8 @@ describe 'java::oracle', type: :define do let(:title) { 'jdk6' } it { is_expected.to contain_archive('/tmp/jdk-6u45-linux-x64-rpm.bin') } - it { is_expected.to contain_exec('Install Oracle java_se jdk 6').with_command('sh /tmp/jdk-6u45-linux-x64-rpm.bin -x; rpm --force -iv sun*.rpm; rpm --force -iv jdk*.rpm') } - it { is_expected.to contain_exec('Install Oracle java_se jdk 6').that_requires('Archive[/tmp/jdk-6u45-linux-x64-rpm.bin]') } + it { is_expected.to contain_exec('Install Oracle java_se jdk 6 6u45 b06').with_command('sh /tmp/jdk-6u45-linux-x64-rpm.bin -x; rpm --force -iv sun*.rpm; rpm --force -iv jdk*.rpm') } + it { is_expected.to contain_exec('Install Oracle java_se jdk 6 6u45 b06').that_requires('Archive[/tmp/jdk-6u45-linux-x64-rpm.bin]') } end context 'when Oracle Java SE 7 JDK' do @@ -20,8 +20,8 @@ describe 'java::oracle', type: :define do let(:title) { 'jdk7' } it { is_expected.to contain_archive('/tmp/jdk-7u80-linux-x64.rpm') } - it { is_expected.to contain_exec('Install Oracle java_se jdk 7').with_command('rpm --force -iv /tmp/jdk-7u80-linux-x64.rpm') } - it { is_expected.to contain_exec('Install Oracle java_se jdk 7').that_requires('Archive[/tmp/jdk-7u80-linux-x64.rpm]') } + it { is_expected.to contain_exec('Install Oracle java_se jdk 7 7u80 b15').with_command('rpm --force -iv /tmp/jdk-7u80-linux-x64.rpm') } + it { is_expected.to contain_exec('Install Oracle java_se jdk 7 7u80 b15').that_requires('Archive[/tmp/jdk-7u80-linux-x64.rpm]') } end context 'when Oracle Java SE 8 JDK' do @@ -29,8 +29,8 @@ describe 'java::oracle', type: :define do let(:title) { 'jdk8' } it { is_expected.to contain_archive('/tmp/jdk-8u131-linux-x64.rpm') } - it { is_expected.to contain_exec('Install Oracle java_se jdk 8').with_command('rpm --force -iv /tmp/jdk-8u131-linux-x64.rpm') } - it { is_expected.to contain_exec('Install Oracle java_se jdk 8').that_requires('Archive[/tmp/jdk-8u131-linux-x64.rpm]') } + it { is_expected.to contain_exec('Install Oracle java_se jdk 8 8u131 b11').with_command('rpm --force -iv /tmp/jdk-8u131-linux-x64.rpm') } + it { is_expected.to contain_exec('Install Oracle java_se jdk 8 8u131 b11').that_requires('Archive[/tmp/jdk-8u131-linux-x64.rpm]') } end context 'when Oracle Java SE 6 JRE' do @@ -38,8 +38,8 @@ describe 'java::oracle', type: :define do let(:title) { 'jre6' } it { is_expected.to contain_archive('/tmp/jre-6u45-linux-x64-rpm.bin') } - it { is_expected.to contain_exec('Install Oracle java_se jre 6').with_command('sh /tmp/jre-6u45-linux-x64-rpm.bin -x; rpm --force -iv sun*.rpm; rpm --force -iv jre*.rpm') } - it { is_expected.to contain_exec('Install Oracle java_se jre 6').that_requires('Archive[/tmp/jre-6u45-linux-x64-rpm.bin]') } + it { is_expected.to contain_exec('Install Oracle java_se jre 6 6u45 b06').with_command('sh /tmp/jre-6u45-linux-x64-rpm.bin -x; rpm --force -iv sun*.rpm; rpm --force -iv jre*.rpm') } + it { is_expected.to contain_exec('Install Oracle java_se jre 6 6u45 b06').that_requires('Archive[/tmp/jre-6u45-linux-x64-rpm.bin]') } end context 'when Oracle Java SE 7 JRE' do @@ -47,8 +47,8 @@ describe 'java::oracle', type: :define do let(:title) { 'jre7' } it { is_expected.to contain_archive('/tmp/jre-7u80-linux-x64.rpm') } - it { is_expected.to contain_exec('Install Oracle java_se jre 7').with_command('rpm --force -iv /tmp/jre-7u80-linux-x64.rpm') } - it { is_expected.to contain_exec('Install Oracle java_se jre 7').that_requires('Archive[/tmp/jre-7u80-linux-x64.rpm]') } + it { is_expected.to contain_exec('Install Oracle java_se jre 7 7u80 b15').with_command('rpm --force -iv /tmp/jre-7u80-linux-x64.rpm') } + it { is_expected.to contain_exec('Install Oracle java_se jre 7 7u80 b15').that_requires('Archive[/tmp/jre-7u80-linux-x64.rpm]') } end context 'when select Oracle Java SE 8 JRE' do @@ -56,8 +56,8 @@ describe 'java::oracle', type: :define do let(:title) { 'jre8' } it { is_expected.to contain_archive('/tmp/jre-8u131-linux-x64.rpm') } - it { is_expected.to contain_exec('Install Oracle java_se jre 8').with_command('rpm --force -iv /tmp/jre-8u131-linux-x64.rpm') } - it { is_expected.to contain_exec('Install Oracle java_se jre 8').that_requires('Archive[/tmp/jre-8u131-linux-x64.rpm]') } + it { is_expected.to contain_exec('Install Oracle java_se jre 8 8u131 b11').with_command('rpm --force -iv /tmp/jre-8u131-linux-x64.rpm') } + it { is_expected.to contain_exec('Install Oracle java_se jre 8 8u131 b11').that_requires('Archive[/tmp/jre-8u131-linux-x64.rpm]') } end context 'when passing URL to url parameter' do @@ -93,6 +93,34 @@ describe 'java::oracle', type: :define do it { is_expected.to contain_archive('/tmp/jdk-8u131-linux-x64.rpm').with_source('http://download.oracle.com/otn-pub/java/jdk//8u131-b11/abcdef01234567890/jdk-8u131-linux-x64.rpm') } end + + context 'when installing multiple versions' do + let(:params) do + { + ensure: 'present', + version_major: '8u131', + version_minor: 'b11', + java_se: 'jdk', + url_hash: 'abcdef01234567890', + } + end + let(:title) { 'jdk8' } + + let(:pre_condition) do + <<-EOL + java::oracle { + 'jdk8121': + ensure => 'present', + version_major => '8u121', + version_minor => 'b11', + java_se => 'jdk', + url_hash => 'fiewojgfuiowfniweof', + } + EOL + end + + it { is_expected.to compile } + end end context 'when on CentOS 32-bit' do @@ -103,8 +131,8 @@ describe 'java::oracle', type: :define do let(:title) { 'jdk6' } it { is_expected.to contain_archive('/tmp/jdk-6u45-linux-i586-rpm.bin') } - it { is_expected.to contain_exec('Install Oracle java_se jdk 6').with_command('sh /tmp/jdk-6u45-linux-i586-rpm.bin -x; rpm --force -iv sun*.rpm; rpm --force -iv jdk*.rpm') } - it { is_expected.to contain_exec('Install Oracle java_se jdk 6').that_requires('Archive[/tmp/jdk-6u45-linux-i586-rpm.bin]') } + it { is_expected.to contain_exec('Install Oracle java_se jdk 6 6u45 b06').with_command('sh /tmp/jdk-6u45-linux-i586-rpm.bin -x; rpm --force -iv sun*.rpm; rpm --force -iv jdk*.rpm') } + it { is_expected.to contain_exec('Install Oracle java_se jdk 6 6u45 b06').that_requires('Archive[/tmp/jdk-6u45-linux-i586-rpm.bin]') } end context 'when selecting Oracle Java SE 7 JDK on RedHat family, 32-bit' do @@ -112,8 +140,8 @@ describe 'java::oracle', type: :define do let(:title) { 'jdk7' } it { is_expected.to contain_archive('/tmp/jdk-7u80-linux-i586.rpm') } - it { is_expected.to contain_exec('Install Oracle java_se jdk 7').with_command('rpm --force -iv /tmp/jdk-7u80-linux-i586.rpm') } - it { is_expected.to contain_exec('Install Oracle java_se jdk 7').that_requires('Archive[/tmp/jdk-7u80-linux-i586.rpm]') } + it { is_expected.to contain_exec('Install Oracle java_se jdk 7 7u80 b15').with_command('rpm --force -iv /tmp/jdk-7u80-linux-i586.rpm') } + it { is_expected.to contain_exec('Install Oracle java_se jdk 7 7u80 b15').that_requires('Archive[/tmp/jdk-7u80-linux-i586.rpm]') } end context 'when selecting Oracle Java SE 8 JDK on RedHat family, 32-bit' do @@ -121,8 +149,8 @@ describe 'java::oracle', type: :define do let(:title) { 'jdk8' } it { is_expected.to contain_archive('/tmp/jdk-8u131-linux-i586.rpm') } - it { is_expected.to contain_exec('Install Oracle java_se jdk 8').with_command('rpm --force -iv /tmp/jdk-8u131-linux-i586.rpm') } - it { is_expected.to contain_exec('Install Oracle java_se jdk 8').that_requires('Archive[/tmp/jdk-8u131-linux-i586.rpm]') } + it { is_expected.to contain_exec('Install Oracle java_se jdk 8 8u131 b11').with_command('rpm --force -iv /tmp/jdk-8u131-linux-i586.rpm') } + it { is_expected.to contain_exec('Install Oracle java_se jdk 8 8u131 b11').that_requires('Archive[/tmp/jdk-8u131-linux-i586.rpm]') } end context 'when selecting Oracle Java SE 6 JRE on RedHat family, 32-bit' do @@ -130,8 +158,8 @@ describe 'java::oracle', type: :define do let(:title) { 'jdk6' } it { is_expected.to contain_archive('/tmp/jre-6u45-linux-i586-rpm.bin') } - it { is_expected.to contain_exec('Install Oracle java_se jre 6').with_command('sh /tmp/jre-6u45-linux-i586-rpm.bin -x; rpm --force -iv sun*.rpm; rpm --force -iv jre*.rpm') } - it { is_expected.to contain_exec('Install Oracle java_se jre 6').that_requires('Archive[/tmp/jre-6u45-linux-i586-rpm.bin]') } + it { is_expected.to contain_exec('Install Oracle java_se jre 6 6u45 b06').with_command('sh /tmp/jre-6u45-linux-i586-rpm.bin -x; rpm --force -iv sun*.rpm; rpm --force -iv jre*.rpm') } + it { is_expected.to contain_exec('Install Oracle java_se jre 6 6u45 b06').that_requires('Archive[/tmp/jre-6u45-linux-i586-rpm.bin]') } end context 'when select Oracle Java SE 7 JRE on RedHat family, 32-bit' do @@ -139,8 +167,8 @@ describe 'java::oracle', type: :define do let(:title) { 'jdk7' } it { is_expected.to contain_archive('/tmp/jre-7u80-linux-i586.rpm') } - it { is_expected.to contain_exec('Install Oracle java_se jre 7').with_command('rpm --force -iv /tmp/jre-7u80-linux-i586.rpm') } - it { is_expected.to contain_exec('Install Oracle java_se jre 7').that_requires('Archive[/tmp/jre-7u80-linux-i586.rpm]') } + it { is_expected.to contain_exec('Install Oracle java_se jre 7 7u80 b15').with_command('rpm --force -iv /tmp/jre-7u80-linux-i586.rpm') } + it { is_expected.to contain_exec('Install Oracle java_se jre 7 7u80 b15').that_requires('Archive[/tmp/jre-7u80-linux-i586.rpm]') } end context 'when select Oracle Java SE 8 JRE on RedHat family, 32-bit' do @@ -148,8 +176,36 @@ describe 'java::oracle', type: :define do let(:title) { 'jdk8' } it { is_expected.to contain_archive('/tmp/jre-8u131-linux-i586.rpm') } - it { is_expected.to contain_exec('Install Oracle java_se jre 8').with_command('rpm --force -iv /tmp/jre-8u131-linux-i586.rpm') } - it { is_expected.to contain_exec('Install Oracle java_se jre 8').that_requires('Archive[/tmp/jre-8u131-linux-i586.rpm]') } + it { is_expected.to contain_exec('Install Oracle java_se jre 8 8u131 b11').with_command('rpm --force -iv /tmp/jre-8u131-linux-i586.rpm') } + it { is_expected.to contain_exec('Install Oracle java_se jre 8 8u131 b11').that_requires('Archive[/tmp/jre-8u131-linux-i586.rpm]') } + end + + context 'when installing multiple versions' do + let(:params) do + { + ensure: 'present', + version_major: '8u131', + version_minor: 'b11', + java_se: 'jdk', + url_hash: 'abcdef01234567890', + } + end + let(:title) { 'jdk8' } + + let(:pre_condition) do + <<-EOL + java::oracle { + 'jdk8121': + ensure => 'present', + version_major => '8u121', + version_minor => 'b11', + java_se => 'jdk', + url_hash => 'fiewojgfuiowfniweof', + } + EOL + end + + it { is_expected.to compile } end end @@ -161,8 +217,8 @@ describe 'java::oracle', type: :define do let(:title) { 'jdk6' } it { is_expected.to contain_archive('/tmp/jdk-6u45-linux-x64.tar.gz') } - it { is_expected.to contain_exec('Install Oracle java_se jdk 6').with_command('tar -zxf /tmp/jdk-6u45-linux-x64.tar.gz -C /usr/lib/jvm') } - it { is_expected.to contain_exec('Install Oracle java_se jdk 6').that_requires('Archive[/tmp/jdk-6u45-linux-x64.tar.gz]') } + it { is_expected.to contain_exec('Install Oracle java_se jdk 6 6u45 b06').with_command('tar -zxf /tmp/jdk-6u45-linux-x64.tar.gz -C /usr/lib/jvm') } + it { is_expected.to contain_exec('Install Oracle java_se jdk 6 6u45 b06').that_requires('Archive[/tmp/jdk-6u45-linux-x64.tar.gz]') } end context 'with Oracle Java SE 7 JDK' do @@ -170,8 +226,8 @@ describe 'java::oracle', type: :define do let(:title) { 'jdk7' } it { is_expected.to contain_archive('/tmp/jdk-7u80-linux-x64.tar.gz') } - it { is_expected.to contain_exec('Install Oracle java_se jdk 7').with_command('tar -zxf /tmp/jdk-7u80-linux-x64.tar.gz -C /usr/lib/jvm') } - it { is_expected.to contain_exec('Install Oracle java_se jdk 7').that_requires('Archive[/tmp/jdk-7u80-linux-x64.tar.gz]') } + it { is_expected.to contain_exec('Install Oracle java_se jdk 7 7u80 b15').with_command('tar -zxf /tmp/jdk-7u80-linux-x64.tar.gz -C /usr/lib/jvm') } + it { is_expected.to contain_exec('Install Oracle java_se jdk 7 7u80 b15').that_requires('Archive[/tmp/jdk-7u80-linux-x64.tar.gz]') } end context 'with Oracle Java SE 8 JDK' do @@ -179,8 +235,8 @@ describe 'java::oracle', type: :define do let(:title) { 'jdk8' } it { is_expected.to contain_archive('/tmp/jdk-8u131-linux-x64.tar.gz') } - it { is_expected.to contain_exec('Install Oracle java_se jdk 8').with_command('tar -zxf /tmp/jdk-8u131-linux-x64.tar.gz -C /usr/lib/jvm') } - it { is_expected.to contain_exec('Install Oracle java_se jdk 8').that_requires('Archive[/tmp/jdk-8u131-linux-x64.tar.gz]') } + it { is_expected.to contain_exec('Install Oracle java_se jdk 8 8u131 b11').with_command('tar -zxf /tmp/jdk-8u131-linux-x64.tar.gz -C /usr/lib/jvm') } + it { is_expected.to contain_exec('Install Oracle java_se jdk 8 8u131 b11').that_requires('Archive[/tmp/jdk-8u131-linux-x64.tar.gz]') } end context 'with Oracle Java SE 6 JRE' do @@ -188,8 +244,8 @@ describe 'java::oracle', type: :define do let(:title) { 'jre6' } it { is_expected.to contain_archive('/tmp/jre-6u45-linux-x64.tar.gz') } - it { is_expected.to contain_exec('Install Oracle java_se jre 6').with_command('tar -zxf /tmp/jre-6u45-linux-x64.tar.gz -C /usr/lib/jvm') } - it { is_expected.to contain_exec('Install Oracle java_se jre 6').that_requires('Archive[/tmp/jre-6u45-linux-x64.tar.gz]') } + it { is_expected.to contain_exec('Install Oracle java_se jre 6 6u45 b06').with_command('tar -zxf /tmp/jre-6u45-linux-x64.tar.gz -C /usr/lib/jvm') } + it { is_expected.to contain_exec('Install Oracle java_se jre 6 6u45 b06').that_requires('Archive[/tmp/jre-6u45-linux-x64.tar.gz]') } end context 'when Oracle Java SE 7 JRE' do @@ -197,8 +253,8 @@ describe 'java::oracle', type: :define do let(:title) { 'jre7' } it { is_expected.to contain_archive('/tmp/jre-7u80-linux-x64.tar.gz') } - it { is_expected.to contain_exec('Install Oracle java_se jre 7').with_command('tar -zxf /tmp/jre-7u80-linux-x64.tar.gz -C /usr/lib/jvm') } - it { is_expected.to contain_exec('Install Oracle java_se jre 7').that_requires('Archive[/tmp/jre-7u80-linux-x64.tar.gz]') } + it { is_expected.to contain_exec('Install Oracle java_se jre 7 7u80 b15').with_command('tar -zxf /tmp/jre-7u80-linux-x64.tar.gz -C /usr/lib/jvm') } + it { is_expected.to contain_exec('Install Oracle java_se jre 7 7u80 b15').that_requires('Archive[/tmp/jre-7u80-linux-x64.tar.gz]') } end context 'when Oracle Java SE 8 JRE' do @@ -206,8 +262,8 @@ describe 'java::oracle', type: :define do let(:title) { 'jre8' } it { is_expected.to contain_archive('/tmp/jre-8u131-linux-x64.tar.gz') } - it { is_expected.to contain_exec('Install Oracle java_se jre 8').with_command('tar -zxf /tmp/jre-8u131-linux-x64.tar.gz -C /usr/lib/jvm') } - it { is_expected.to contain_exec('Install Oracle java_se jre 8').that_requires('Archive[/tmp/jre-8u131-linux-x64.tar.gz]') } + it { is_expected.to contain_exec('Install Oracle java_se jre 8 8u131 b11').with_command('tar -zxf /tmp/jre-8u131-linux-x64.tar.gz -C /usr/lib/jvm') } + it { is_expected.to contain_exec('Install Oracle java_se jre 8 8u131 b11').that_requires('Archive[/tmp/jre-8u131-linux-x64.tar.gz]') } end context 'when passing URL to url parameter' do @@ -216,6 +272,34 @@ describe 'java::oracle', type: :define do it { is_expected.to contain_archive('/tmp/jdk-8u131-linux-x64.tar.gz') } end + + context 'when installing multiple versions' do + let(:params) do + { + ensure: 'present', + version_major: '8u131', + version_minor: 'b11', + java_se: 'jdk', + url_hash: 'abcdef01234567890', + } + end + let(:title) { 'jdk8' } + + let(:pre_condition) do + <<-EOL + java::oracle { + 'jdk8121': + ensure => 'present', + version_major => '8u121', + version_minor => 'b11', + java_se => 'jdk', + url_hash => 'fiewojgfuiowfniweof', + } + EOL + end + + it { is_expected.to compile } + end end describe 'incompatible OSes' do [ From bf26247f55e681859a70037ef180f9c1943a76e9 Mon Sep 17 00:00:00 2001 From: Dennis Ploeger Date: Fri, 12 Oct 2018 14:27:59 +0200 Subject: [PATCH 11/17] Fixed style violations --- spec/defines/oracle_spec.rb | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/spec/defines/oracle_spec.rb b/spec/defines/oracle_spec.rb index 3674b76..0a6a40e 100644 --- a/spec/defines/oracle_spec.rb +++ b/spec/defines/oracle_spec.rb @@ -183,11 +183,11 @@ describe 'java::oracle', type: :define do context 'when installing multiple versions' do let(:params) do { - ensure: 'present', - version_major: '8u131', - version_minor: 'b11', - java_se: 'jdk', - url_hash: 'abcdef01234567890', + ensure: 'present', + version_major: '8u131', + version_minor: 'b11', + java_se: 'jdk', + url_hash: 'abcdef01234567890', } end let(:title) { 'jdk8' } @@ -276,11 +276,11 @@ describe 'java::oracle', type: :define do context 'when installing multiple versions' do let(:params) do { - ensure: 'present', - version_major: '8u131', - version_minor: 'b11', - java_se: 'jdk', - url_hash: 'abcdef01234567890', + ensure: 'present', + version_major: '8u131', + version_minor: 'b11', + java_se: 'jdk', + url_hash: 'abcdef01234567890', } end let(:title) { 'jdk8' } From 911df2d7b77d764c06a7aadbcc57e9a6d56cb6e8 Mon Sep 17 00:00:00 2001 From: Michael Moll Date: Thu, 11 Oct 2018 18:47:03 +0200 Subject: [PATCH 12/17] Fix OpenJDK paths on Debian based OS with ARM --- manifests/params.pp | 43 ++++++++++++++++++++++----------------- spec/classes/java_spec.rb | 16 +++++++++++++++ 2 files changed, 40 insertions(+), 19 deletions(-) diff --git a/manifests/params.pp b/manifests/params.pp index e69a19d..8da6122 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -74,18 +74,23 @@ class java::params { 'amd64' => 'x64', default => $::architecture } + $openjdk_architecture = $::architecture ? { + 'aarch64' => 'arm64', + 'armv7l' => 'armhf', + default => $::architecture + } case $::lsbdistcodename { 'lenny', 'squeeze', 'lucid', 'natty': { $java = { 'jdk' => { 'package' => 'openjdk-6-jdk', - 'alternative' => "java-6-openjdk-${::architecture}", + 'alternative' => "java-6-openjdk-${openjdk_architecture}", 'alternative_path' => '/usr/lib/jvm/java-6-openjdk/jre/bin/java', 'java_home' => '/usr/lib/jvm/java-6-openjdk/jre/', }, 'jre' => { 'package' => 'openjdk-6-jre-headless', - 'alternative' => "java-6-openjdk-${::architecture}", + 'alternative' => "java-6-openjdk-${openjdk_architecture}", 'alternative_path' => '/usr/lib/jvm/java-6-openjdk/jre/bin/java', 'java_home' => '/usr/lib/jvm/java-6-openjdk/jre/', }, @@ -107,15 +112,15 @@ class java::params { $java = { 'jdk' => { 'package' => 'openjdk-7-jdk', - 'alternative' => "java-1.7.0-openjdk-${::architecture}", - 'alternative_path' => "/usr/lib/jvm/java-1.7.0-openjdk-${::architecture}/bin/java", - 'java_home' => "/usr/lib/jvm/java-1.7.0-openjdk-${::architecture}/", + 'alternative' => "java-1.7.0-openjdk-${openjdk_architecture}", + 'alternative_path' => "/usr/lib/jvm/java-1.7.0-openjdk-${openjdk_architecture}/bin/java", + 'java_home' => "/usr/lib/jvm/java-1.7.0-openjdk-${openjdk_architecture}/", }, 'jre' => { 'package' => 'openjdk-7-jre-headless', 'alternative' => "java-1.7.0-openjdk-${::architecture}", - 'alternative_path' => "/usr/lib/jvm/java-1.7.0-openjdk-${::architecture}/bin/java", - 'java_home' => "/usr/lib/jvm/java-1.7.0-openjdk-${::architecture}/", + 'alternative_path' => "/usr/lib/jvm/java-1.7.0-openjdk-${openjdk_architecture}/bin/java", + 'java_home' => "/usr/lib/jvm/java-1.7.0-openjdk-${openjdk_architecture}/", }, 'oracle-jre' => { 'package' => 'oracle-j2re1.7', @@ -159,15 +164,15 @@ class java::params { $java = { 'jdk' => { 'package' => 'openjdk-8-jdk', - 'alternative' => "java-1.8.0-openjdk-${::architecture}", - 'alternative_path' => "/usr/lib/jvm/java-1.8.0-openjdk-${::architecture}/bin/java", - 'java_home' => "/usr/lib/jvm/java-1.8.0-openjdk-${::architecture}/", + 'alternative' => "java-1.8.0-openjdk-${openjdk_architecture}", + 'alternative_path' => "/usr/lib/jvm/java-1.8.0-openjdk-${openjdk_architecture}/bin/java", + 'java_home' => "/usr/lib/jvm/java-1.8.0-openjdk-${openjdk_architecture}/", }, 'jre' => { 'package' => 'openjdk-8-jre-headless', - 'alternative' => "java-1.8.0-openjdk-${::architecture}", - 'alternative_path' => "/usr/lib/jvm/java-1.8.0-openjdk-${::architecture}/bin/java", - 'java_home' => "/usr/lib/jvm/java-1.8.0-openjdk-${::architecture}/", + 'alternative' => "java-1.8.0-openjdk-${openjdk_architecture}", + 'alternative_path' => "/usr/lib/jvm/java-1.8.0-openjdk-${openjdk_architecture}/bin/java", + 'java_home' => "/usr/lib/jvm/java-1.8.0-openjdk-${openjdk_architecture}/", } } } @@ -175,15 +180,15 @@ class java::params { $java = { 'jdk' => { 'package' => 'openjdk-11-jdk', - 'alternative' => "java-1.11.0-openjdk-${::architecture}", - 'alternative_path' => "/usr/lib/jvm/java-1.11.0-openjdk-${::architecture}/bin/java", - 'java_home' => "/usr/lib/jvm/java-1.11.0-openjdk-${::architecture}/", + 'alternative' => "java-1.11.0-openjdk-${openjdk_architecture}", + 'alternative_path' => "/usr/lib/jvm/java-1.11.0-openjdk-${openjdk_architecture}/bin/java", + 'java_home' => "/usr/lib/jvm/java-1.11.0-openjdk-${openjdk_architecture}/", }, 'jre' => { 'package' => 'openjdk-11-jre-headless', - 'alternative' => "java-1.11.0-openjdk-${::architecture}", - 'alternative_path' => "/usr/lib/jvm/java-1.11.0-openjdk-${::architecture}/bin/java", - 'java_home' => "/usr/lib/jvm/java-1.11.0-openjdk-${::architecture}/", + 'alternative' => "java-1.11.0-openjdk-${openjdk_architecture}", + 'alternative_path' => "/usr/lib/jvm/java-1.11.0-openjdk-${openjdk_architecture}/bin/java", + 'java_home' => "/usr/lib/jvm/java-1.11.0-openjdk-${openjdk_architecture}/", } } } diff --git a/spec/classes/java_spec.rb b/spec/classes/java_spec.rb index a82850b..2764b8f 100644 --- a/spec/classes/java_spec.rb +++ b/spec/classes/java_spec.rb @@ -69,6 +69,22 @@ describe 'java', type: :class do it { is_expected.to contain_file_line('java-home-environment').with_line('JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64/') } end + context 'when select jdk for Ubuntu xenial (16.04) on ARM' do + let(:facts) { { osfamily: 'Debian', operatingsystem: 'Ubuntu', lsbdistcodename: 'xenial', operatingsystemrelease: '16.04', architecture: 'armv7l' } } + let(:params) { { 'distribution' => 'jdk' } } + + it { is_expected.to contain_package('java').with_name('openjdk-8-jdk') } + it { is_expected.to contain_file_line('java-home-environment').with_line('JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-armhf/') } + end + + context 'when select jdk for Ubuntu xenial (16.04) on ARM64' do + let(:facts) { { osfamily: 'Debian', operatingsystem: 'Ubuntu', lsbdistcodename: 'xenial', operatingsystemrelease: '16.04', architecture: 'aarch64' } } + let(:params) { { 'distribution' => 'jdk' } } + + it { is_expected.to contain_package('java').with_name('openjdk-8-jdk') } + it { is_expected.to contain_file_line('java-home-environment').with_line('JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-arm64/') } + end + context 'when select openjdk for Amazon Linux' do let(:facts) { { osfamily: 'RedHat', operatingsystem: 'Amazon', operatingsystemrelease: '3.4.43-43.43.amzn1.x86_64', architecture: 'x86_64' } } From b53a78fbe8b2ec0bf13c6ac13f4d11c9a886622d Mon Sep 17 00:00:00 2001 From: Dennis Ploeger Date: Thu, 18 Oct 2018 11:07:37 +0200 Subject: [PATCH 13/17] Support for installing JCE. Fixes MODULES-1681 (#326) * Support for installing JCE. Fixes MODULES-1681 * Disabled oracle tests. Only to be enabled, if the other configuration options match the current java download URL provided by Oracle. --- manifests/oracle.pp | 42 ++++++++++++++- spec/acceptance/install_spec.rb | 92 +++++++++++++++++++++++++++++++++ spec/defines/oracle_spec.rb | 60 +++++++++++++++++++++ 3 files changed, 193 insertions(+), 1 deletion(-) diff --git a/manifests/oracle.pp b/manifests/oracle.pp index 38a9ff6..7a6fdc5 100644 --- a/manifests/oracle.pp +++ b/manifests/oracle.pp @@ -87,6 +87,9 @@ # Directory hash used by the download.oracle.com site. This value is a 32 character string # which is part of the file URL returned by the JDK download site. # +# [*jce*] +# Install Oracles Java Cryptographic Extensions into the JRE or JDK +# # ### Author # mike@marseglia.org # @@ -101,6 +104,7 @@ define java::oracle ( $proxy_type = undef, $url = undef, $url_hash = undef, + $jce = false, ) { # archive module is used to download the java package @@ -111,6 +115,15 @@ define java::oracle ( fail('Java SE must be either jre or jdk.') } + if $jce { + $jce_download = $version ? { + '8' => 'http://download.oracle.com/otn-pub/java/jce/8/jce_policy-8.zip', + '7' => 'http://download.oracle.com/otn-pub/java/jce/7/UnlimitedJCEPolicyJDK7.zip', + '6' => 'http://download.oracle.com/otn-pub/java/jce_policy/6/jce_policy-6.zip', + default => undef + } + } + # determine Oracle Java major and minor version, and installation path if $version_major and $version_minor { @@ -121,7 +134,7 @@ define java::oracle ( if $release_major =~ /(\d+)u(\d+)/ { # Required for CentOS systems where Java8 update number is >= 171 to ensure # the package is visible to Puppet - if $facts['os']['name'] == 'CentOS' and $2 >= '171' { + if $facts['os']['family'] == 'RedHat' and $2 >= '171' { $install_path = "${java_se}1.${1}.0_${2}-amd64" } else { $install_path = "${java_se}1.${1}.0_${2}" @@ -187,6 +200,11 @@ define java::oracle ( fail ( "unsupported platform ${$facts['kernel']}" ) } } + # Install required unzip packages for jce + if $jce { + ensure_resource('package', 'unzip', { 'ensure' => 'present' }) + } + # set java architecture nomenclature case $facts['os']['architecture'] { 'i386' : { $arch = 'i586' } @@ -286,6 +304,28 @@ define java::oracle ( creates => $creates_path, require => $install_requires } + + if ($jce and $jce_download != undef) { + $jce_path = $java_se ? { + 'jre' => "${creates_path}/lib/security", + 'jdk' => "${creates_path}/jre/lib/security" + } + archive { "/tmp/jce-${version}.zip": + source => $jce_download, + cookie => 'gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie', + extract => true, + extract_path => $jce_path, + extract_flags => '-oj', + creates => "${jce_path}/US_export_policy.jar", + cleanup => false, + proxy_server => $proxy_server, + proxy_type => $proxy_type, + require => [ + Package['unzip'], + Exec["Install Oracle java_se ${java_se} ${version} ${release_major} ${release_minor}"] + ] + } + } } default : { fail ("unsupported platform ${$facts['kernel']}") diff --git a/spec/acceptance/install_spec.rb b/spec/acceptance/install_spec.rb index 32fca8b..8891594 100644 --- a/spec/acceptance/install_spec.rb +++ b/spec/acceptance/install_spec.rb @@ -1,5 +1,7 @@ require 'spec_helper_acceptance' +include Unix::File + # RedHat, CentOS, Scientific, Oracle prior to 5.0 : Sun Java JDK/JRE 1.6 # RedHat, CentOS, Scientific, Oracle 5.0 < x < 6.3 : OpenJDK Java JDK/JRE 1.6 # RedHat, CentOS, Scientific, Oracle after 6.3 : OpenJDK Java JDK/JRE 1.7 @@ -79,6 +81,62 @@ bogus_alternative = "class { 'java':\n"\ " java_alternative_path => '/whatever',\n"\ '}' +# Oracle installs are disabled by default, because the links to valid oracle installations +# change often. Look the parameters up from the Oracle download URLs at https://java.oracle.com and +# enable the tests: + +oracle_enabled = false +oracle_version_major = '8' +oracle_version_minor = '181' +oracle_version_build = '13' +oracle_hash = '96a7b8442fe848ef90c96a2fad6ed6d1' + +install_oracle_jre = < '#{oracle_version_major}', + version_major => '#{oracle_version_major}u#{oracle_version_minor}', + version_minor => 'b#{oracle_version_build}', + url_hash => '#{oracle_hash}', + java_se => 'jre', + } +EOL + +install_oracle_jdk = < '#{oracle_version_major}', + version_major => '#{oracle_version_major}u#{oracle_version_minor}', + version_minor => 'b#{oracle_version_build}', + url_hash => '#{oracle_hash}', + java_se => 'jdk', + } +EOL + +install_oracle_jre_jce = < '#{oracle_version_major}', + version_major => '#{oracle_version_major}u#{oracle_version_minor}', + version_minor => 'b#{oracle_version_build}', + url_hash => '#{oracle_hash}', + java_se => 'jre', + jce => true, + } +EOL + +install_oracle_jdk_jce = < '#{oracle_version_major}', + version_major => '#{oracle_version_major}u#{oracle_version_minor}', + version_minor => 'b#{oracle_version_build}', + url_hash => '#{oracle_hash}', + java_se => 'jdk', + jce => true, + } +EOL + context 'installing java jre', unless: UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do it 'installs jre' do apply_manifest(java_class_jre, catch_failures: true) @@ -155,3 +213,37 @@ context 'with failure cases' do end end end + +# Test oracle java installs +context 'java::oracle', if: oracle_enabled, unless: UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do + install_path = '/usr/lib/jvm' + version_suffix = '' + if fact('osfamily') == 'RedHat' || fact('osfamily') == 'Amazon' + install_path = '/usr/java' + version_suffix = '-amd64' + end + it 'installs oracle jdk' do + apply_manifest(install_oracle_jdk, catch_failures: true) + apply_manifest(install_oracle_jdk, catch_changes: true) + result = shell("test ! -e #{install_path}/jdk1.#{oracle_version_major}.0_#{oracle_version_minor}#{version_suffix}/jre/lib/security/local_policy.jar") + expect(result.exit_code).to eq(0) + end + it 'installs oracle jre' do + apply_manifest(install_oracle_jre, catch_failures: true) + apply_manifest(install_oracle_jre, catch_changes: true) + result = shell("test ! -e #{install_path}/jre1.#{oracle_version_major}.0_#{oracle_version_minor}#{version_suffix}/lib/security/local_policy.jar") + expect(result.exit_code).to eq(0) + end + it 'installs oracle jdk with jce' do + apply_manifest(install_oracle_jdk_jce, catch_failures: true) + apply_manifest(install_oracle_jdk_jce, catch_changes: true) + result = shell("test -e #{install_path}/jdk1.#{oracle_version_major}.0_#{oracle_version_minor}#{version_suffix}/jre/lib/security/local_policy.jar") + expect(result.exit_code).to eq(0) + end + it 'installs oracle jre with jce' do + apply_manifest(install_oracle_jre_jce, catch_failures: true) + apply_manifest(install_oracle_jre_jce, catch_changes: true) + result = shell("test -e #{install_path}/jre1.#{oracle_version_major}.0_#{oracle_version_minor}#{version_suffix}/lib/security/local_policy.jar") + expect(result.exit_code).to eq(0) + end +end diff --git a/spec/defines/oracle_spec.rb b/spec/defines/oracle_spec.rb index 0a6a40e..9e97b5f 100644 --- a/spec/defines/oracle_spec.rb +++ b/spec/defines/oracle_spec.rb @@ -121,6 +121,26 @@ describe 'java::oracle', type: :define do it { is_expected.to compile } end + + context 'when installing Oracle Java SE 6 JRE with JCE' do + let(:params) { { ensure: 'present', jce: true, version: '6', version_major: '6u99', version_minor: '99', java_se: 'jre' } } + let(:title) { 'jre6jce' } + + it do + is_expected.to contain_archive('/tmp/jce-6.zip').with_source('http://download.oracle.com/otn-pub/java/jce_policy/6/jce_policy-6.zip') + is_expected.to contain_archive('/tmp/jce-6.zip').with_extract_path('/usr/java/jre1.6.0_99-amd64/lib/security') + end + end + + context 'when installing Oracle Java SE 6 JDK with JCE' do + let(:params) { { ensure: 'present', jce: true, version: '6', version_major: '6u99', version_minor: '99', java_se: 'jdk' } } + let(:title) { 'jre6jce' } + + it do + is_expected.to contain_archive('/tmp/jce-6.zip').with_source('http://download.oracle.com/otn-pub/java/jce_policy/6/jce_policy-6.zip') + is_expected.to contain_archive('/tmp/jce-6.zip').with_extract_path('/usr/java/jdk1.6.0_99-amd64/jre/lib/security') + end + end end context 'when on CentOS 32-bit' do @@ -207,6 +227,26 @@ describe 'java::oracle', type: :define do it { is_expected.to compile } end + + context 'when installing Oracle Java SE 6 JRE with JCE' do + let(:params) { { ensure: 'present', jce: true, version: '6', version_major: '6u99', version_minor: '99', java_se: 'jre' } } + let(:title) { 'jre6jce' } + + it do + is_expected.to contain_archive('/tmp/jce-6.zip').with_source('http://download.oracle.com/otn-pub/java/jce_policy/6/jce_policy-6.zip') + is_expected.to contain_archive('/tmp/jce-6.zip').with_extract_path('/usr/java/jre1.6.0_99-amd64/lib/security') + end + end + + context 'when installing Oracle Java SE 6 JDK with JCE' do + let(:params) { { ensure: 'present', jce: true, version: '6', version_major: '6u99', version_minor: '99', java_se: 'jdk' } } + let(:title) { 'jre6jce' } + + it do + is_expected.to contain_archive('/tmp/jce-6.zip').with_source('http://download.oracle.com/otn-pub/java/jce_policy/6/jce_policy-6.zip') + is_expected.to contain_archive('/tmp/jce-6.zip').with_extract_path('/usr/java/jdk1.6.0_99-amd64/jre/lib/security') + end + end end context 'with Ubuntu 64-bit' do @@ -300,6 +340,26 @@ describe 'java::oracle', type: :define do it { is_expected.to compile } end + + context 'when installing Oracle Java SE 6 JRE with JCE' do + let(:params) { { ensure: 'present', jce: true, version: '6', version_major: '6u99', version_minor: '99', java_se: 'jre' } } + let(:title) { 'jre6jce' } + + it do + is_expected.to contain_archive('/tmp/jce-6.zip').with_source('http://download.oracle.com/otn-pub/java/jce_policy/6/jce_policy-6.zip') + is_expected.to contain_archive('/tmp/jce-6.zip').with_extract_path('/usr/lib/jvm/jre1.6.0_99/lib/security') + end + end + + context 'when installing Oracle Java SE 6 JDK with JCE' do + let(:params) { { ensure: 'present', jce: true, version: '6', version_major: '6u99', version_minor: '99', java_se: 'jdk' } } + let(:title) { 'jre6jce' } + + it do + is_expected.to contain_archive('/tmp/jce-6.zip').with_source('http://download.oracle.com/otn-pub/java/jce_policy/6/jce_policy-6.zip') + is_expected.to contain_archive('/tmp/jce-6.zip').with_extract_path('/usr/lib/jvm/jdk1.6.0_99/jre/lib/security') + end + end end describe 'incompatible OSes' do [ From 0acc804564818a138f90df5c137ec57b5b509b48 Mon Sep 17 00:00:00 2001 From: Paula Muir Date: Tue, 23 Oct 2018 17:30:56 +0100 Subject: [PATCH 14/17] (FM-7520) - Removing service pack extensions We support SLES11 and SLES12. It is not necessary to state the SP therefore removing the SPs. --- metadata.json | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/metadata.json b/metadata.json index 8d4da5f..eb14b95 100644 --- a/metadata.json +++ b/metadata.json @@ -65,13 +65,8 @@ { "operatingsystem": "SLES", "operatingsystemrelease": [ - "11 SP1", - "11 SP2", - "11 SP3", - "11 SP4", - "12", - "12 SP1", - "12 SP2" + "11", + "12" ] }, { From 0fd7c00fa9d66f96071c473199ed99dceda9d49e Mon Sep 17 00:00:00 2001 From: Otto Jongerius Date: Thu, 20 Sep 2018 16:28:01 +1200 Subject: [PATCH 15/17] upgrade Oracle Java 8 to 181, make it the default release --- manifests/oracle.pp | 16 +++---- spec/defines/oracle_spec.rb | 88 ++++++++++++++++++------------------- 2 files changed, 52 insertions(+), 52 deletions(-) diff --git a/manifests/oracle.pp b/manifests/oracle.pp index 7a6fdc5..9df10ef 100644 --- a/manifests/oracle.pp +++ b/manifests/oracle.pp @@ -158,16 +158,16 @@ define java::oracle ( $release_hash = undef } '8' : { - $release_major = '8u131' - $release_minor = 'b11' - $install_path = "${java_se}1.8.0_131" - $release_hash = 'd54c1d3a095b4ff2b6607d096fa80163' + $release_major = '8u181' + $release_minor = 'b13' + $install_path = "${java_se}1.8.0_181" + $release_hash = '96a7b8442fe848ef90c96a2fad6ed6d1' } default : { - $release_major = '8u131' - $release_minor = 'b11' - $install_path = "${java_se}1.8.0_131" - $release_hash = 'd54c1d3a095b4ff2b6607d096fa80163' + $release_major = '8u181' + $release_minor = 'b13' + $install_path = "${java_se}1.8.0_181" + $release_hash = '96a7b8442fe848ef90c96a2fad6ed6d1' } } } diff --git a/spec/defines/oracle_spec.rb b/spec/defines/oracle_spec.rb index 9e97b5f..8c67840 100644 --- a/spec/defines/oracle_spec.rb +++ b/spec/defines/oracle_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -oracle_url = 'http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.tar.gz' +oracle_url = 'http://download.oracle.com/otn-pub/java/jdk/8u181-b13/96a7b8442fe848ef90c96a2fad6ed6d1/jdk-8u181-linux-x64.tar.gz' describe 'java::oracle', type: :define do context 'with CentOS 64-bit' do @@ -28,9 +28,9 @@ describe 'java::oracle', type: :define do let(:params) { { ensure: 'present', version: '8', java_se: 'jdk' } } let(:title) { 'jdk8' } - it { is_expected.to contain_archive('/tmp/jdk-8u131-linux-x64.rpm') } - it { is_expected.to contain_exec('Install Oracle java_se jdk 8 8u131 b11').with_command('rpm --force -iv /tmp/jdk-8u131-linux-x64.rpm') } - it { is_expected.to contain_exec('Install Oracle java_se jdk 8 8u131 b11').that_requires('Archive[/tmp/jdk-8u131-linux-x64.rpm]') } + it { is_expected.to contain_archive('/tmp/jdk-8u181-linux-x64.rpm') } + it { is_expected.to contain_exec('Install Oracle java_se jdk 8 8u181 b13').with_command('rpm --force -iv /tmp/jdk-8u181-linux-x64.rpm') } + it { is_expected.to contain_exec('Install Oracle java_se jdk 8 8u181 b13').that_requires('Archive[/tmp/jdk-8u181-linux-x64.rpm]') } end context 'when Oracle Java SE 6 JRE' do @@ -55,27 +55,27 @@ describe 'java::oracle', type: :define do let(:params) { { ensure: 'present', version: '8', java_se: 'jre' } } let(:title) { 'jre8' } - it { is_expected.to contain_archive('/tmp/jre-8u131-linux-x64.rpm') } - it { is_expected.to contain_exec('Install Oracle java_se jre 8 8u131 b11').with_command('rpm --force -iv /tmp/jre-8u131-linux-x64.rpm') } - it { is_expected.to contain_exec('Install Oracle java_se jre 8 8u131 b11').that_requires('Archive[/tmp/jre-8u131-linux-x64.rpm]') } + it { is_expected.to contain_archive('/tmp/jre-8u181-linux-x64.rpm') } + it { is_expected.to contain_exec('Install Oracle java_se jre 8 8u181 b13').with_command('rpm --force -iv /tmp/jre-8u181-linux-x64.rpm') } + it { is_expected.to contain_exec('Install Oracle java_se jre 8 8u181 b13').that_requires('Archive[/tmp/jre-8u181-linux-x64.rpm]') } end context 'when passing URL to url parameter' do let(:params) do { ensure: 'present', - version_major: '8u131', - version_minor: 'b11', + version_major: '8u181', + version_minor: 'b13', java_se: 'jdk', - url: 'http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.rpm', + url: 'http://download.oracle.com/otn-pub/java/jdk/8u181-b13/96a7b8442fe848ef90c96a2fad6ed6d1/jdk-8u181-linux-x64.rpm', url_hash: 'ignored', } end let(:title) { 'jdk8' } it { - is_expected.to contain_archive('/tmp/jdk-8u131-linux-x64.rpm') - .with_source('http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.rpm') + is_expected.to contain_archive('/tmp/jdk-8u181-linux-x64.rpm') + .with_source('http://download.oracle.com/otn-pub/java/jdk/8u181-b13/96a7b8442fe848ef90c96a2fad6ed6d1/jdk-8u181-linux-x64.rpm') } end @@ -83,25 +83,25 @@ describe 'java::oracle', type: :define do let(:params) do { ensure: 'present', - version_major: '8u131', - version_minor: 'b11', + version_major: '8u181', + version_minor: 'b13', java_se: 'jdk', url_hash: 'abcdef01234567890', } end let(:title) { 'jdk8' } - it { is_expected.to contain_archive('/tmp/jdk-8u131-linux-x64.rpm').with_source('http://download.oracle.com/otn-pub/java/jdk//8u131-b11/abcdef01234567890/jdk-8u131-linux-x64.rpm') } + it { is_expected.to contain_archive('/tmp/jdk-8u181-linux-x64.rpm').with_source('http://download.oracle.com/otn-pub/java/jdk//8u181-b13/abcdef01234567890/jdk-8u181-linux-x64.rpm') } end context 'when installing multiple versions' do let(:params) do { ensure: 'present', - version_major: '8u131', - version_minor: 'b11', + version_major: '8u181', + version_minor: 'b13', java_se: 'jdk', - url_hash: 'abcdef01234567890', + url_hash: '96a7b8442fe848ef90c96a2fad6ed6d1', } end let(:title) { 'jdk8' } @@ -111,10 +111,10 @@ describe 'java::oracle', type: :define do java::oracle { 'jdk8121': ensure => 'present', - version_major => '8u121', + version_major => '8u131', version_minor => 'b11', java_se => 'jdk', - url_hash => 'fiewojgfuiowfniweof', + url_hash => 'abcdef01234567890', } EOL end @@ -168,9 +168,9 @@ describe 'java::oracle', type: :define do let(:params) { { ensure: 'present', version: '8', java_se: 'jdk' } } let(:title) { 'jdk8' } - it { is_expected.to contain_archive('/tmp/jdk-8u131-linux-i586.rpm') } - it { is_expected.to contain_exec('Install Oracle java_se jdk 8 8u131 b11').with_command('rpm --force -iv /tmp/jdk-8u131-linux-i586.rpm') } - it { is_expected.to contain_exec('Install Oracle java_se jdk 8 8u131 b11').that_requires('Archive[/tmp/jdk-8u131-linux-i586.rpm]') } + it { is_expected.to contain_archive('/tmp/jdk-8u181-linux-i586.rpm') } + it { is_expected.to contain_exec('Install Oracle java_se jdk 8 8u181 b13').with_command('rpm --force -iv /tmp/jdk-8u181-linux-i586.rpm') } + it { is_expected.to contain_exec('Install Oracle java_se jdk 8 8u181 b13').that_requires('Archive[/tmp/jdk-8u181-linux-i586.rpm]') } end context 'when selecting Oracle Java SE 6 JRE on RedHat family, 32-bit' do @@ -195,19 +195,19 @@ describe 'java::oracle', type: :define do let(:params) { { ensure: 'present', version: '8', java_se: 'jre' } } let(:title) { 'jdk8' } - it { is_expected.to contain_archive('/tmp/jre-8u131-linux-i586.rpm') } - it { is_expected.to contain_exec('Install Oracle java_se jre 8 8u131 b11').with_command('rpm --force -iv /tmp/jre-8u131-linux-i586.rpm') } - it { is_expected.to contain_exec('Install Oracle java_se jre 8 8u131 b11').that_requires('Archive[/tmp/jre-8u131-linux-i586.rpm]') } + it { is_expected.to contain_archive('/tmp/jre-8u181-linux-i586.rpm') } + it { is_expected.to contain_exec('Install Oracle java_se jre 8 8u181 b13').with_command('rpm --force -iv /tmp/jre-8u181-linux-i586.rpm') } + it { is_expected.to contain_exec('Install Oracle java_se jre 8 8u181 b13').that_requires('Archive[/tmp/jre-8u181-linux-i586.rpm]') } end context 'when installing multiple versions' do let(:params) do { ensure: 'present', - version_major: '8u131', - version_minor: 'b11', + version_major: '8u181', + version_minor: 'b13', java_se: 'jdk', - url_hash: 'abcdef01234567890', + url_hash: '96a7b8442fe848ef90c96a2fad6ed6d1', } end let(:title) { 'jdk8' } @@ -217,10 +217,10 @@ describe 'java::oracle', type: :define do java::oracle { 'jdk8121': ensure => 'present', - version_major => '8u121', + version_major => '8u131', version_minor => 'b11', java_se => 'jdk', - url_hash => 'fiewojgfuiowfniweof', + url_hash => 'abcdef01234567890', } EOL end @@ -274,9 +274,9 @@ describe 'java::oracle', type: :define do let(:params) { { ensure: 'present', version: '8', java_se: 'jdk' } } let(:title) { 'jdk8' } - it { is_expected.to contain_archive('/tmp/jdk-8u131-linux-x64.tar.gz') } - it { is_expected.to contain_exec('Install Oracle java_se jdk 8 8u131 b11').with_command('tar -zxf /tmp/jdk-8u131-linux-x64.tar.gz -C /usr/lib/jvm') } - it { is_expected.to contain_exec('Install Oracle java_se jdk 8 8u131 b11').that_requires('Archive[/tmp/jdk-8u131-linux-x64.tar.gz]') } + it { is_expected.to contain_archive('/tmp/jdk-8u181-linux-x64.tar.gz') } + it { is_expected.to contain_exec('Install Oracle java_se jdk 8 8u181 b13').with_command('tar -zxf /tmp/jdk-8u181-linux-x64.tar.gz -C /usr/lib/jvm') } + it { is_expected.to contain_exec('Install Oracle java_se jdk 8 8u181 b13').that_requires('Archive[/tmp/jdk-8u181-linux-x64.tar.gz]') } end context 'with Oracle Java SE 6 JRE' do @@ -301,26 +301,26 @@ describe 'java::oracle', type: :define do let(:params) { { ensure: 'present', version: '8', java_se: 'jre' } } let(:title) { 'jre8' } - it { is_expected.to contain_archive('/tmp/jre-8u131-linux-x64.tar.gz') } - it { is_expected.to contain_exec('Install Oracle java_se jre 8 8u131 b11').with_command('tar -zxf /tmp/jre-8u131-linux-x64.tar.gz -C /usr/lib/jvm') } - it { is_expected.to contain_exec('Install Oracle java_se jre 8 8u131 b11').that_requires('Archive[/tmp/jre-8u131-linux-x64.tar.gz]') } + it { is_expected.to contain_archive('/tmp/jre-8u181-linux-x64.tar.gz') } + it { is_expected.to contain_exec('Install Oracle java_se jre 8 8u181 b13').with_command('tar -zxf /tmp/jre-8u181-linux-x64.tar.gz -C /usr/lib/jvm') } + it { is_expected.to contain_exec('Install Oracle java_se jre 8 8u181 b13').that_requires('Archive[/tmp/jre-8u181-linux-x64.tar.gz]') } end context 'when passing URL to url parameter' do - let(:params) { { ensure: 'present', version_major: '8u131', version_minor: 'b11', java_se: 'jdk', url: oracle_url.to_s } } + let(:params) { { ensure: 'present', version_major: '8u181', version_minor: 'b13', java_se: 'jdk', url: oracle_url.to_s } } let(:title) { 'jdk8' } - it { is_expected.to contain_archive('/tmp/jdk-8u131-linux-x64.tar.gz') } + it { is_expected.to contain_archive('/tmp/jdk-8u181-linux-x64.tar.gz') } end context 'when installing multiple versions' do let(:params) do { ensure: 'present', - version_major: '8u131', - version_minor: 'b11', + version_major: '8u181', + version_minor: 'b13', java_se: 'jdk', - url_hash: 'abcdef01234567890', + url_hash: '96a7b8442fe848ef90c96a2fad6ed6d1', } end let(:title) { 'jdk8' } @@ -330,10 +330,10 @@ describe 'java::oracle', type: :define do java::oracle { 'jdk8121': ensure => 'present', - version_major => '8u121', + version_major => '8u131', version_minor => 'b11', java_se => 'jdk', - url_hash => 'fiewojgfuiowfniweof', + url_hash => 'abcdef01234567890', } EOL end From a5ea78aeb4045a78e39bb720d198890fc8424d94 Mon Sep 17 00:00:00 2001 From: David Swan Date: Wed, 7 Nov 2018 10:22:33 +0000 Subject: [PATCH 16/17] pdksync_heads/master-0-gabccfb1 --- metadata.json | 2 +- spec/spec_helper.rb | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/metadata.json b/metadata.json index eb14b95..e56ec02 100644 --- a/metadata.json +++ b/metadata.json @@ -83,6 +83,6 @@ } ], "template-url": "https://github.com/puppetlabs/pdk-templates", - "template-ref": "heads/master-0-g8fc95db", + "template-ref": "heads/master-0-gabccfb1", "pdk-version": "1.7.0" } diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 5e721b7..a7281d5 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,11 +1,7 @@ require 'puppetlabs_spec_helper/module_spec_helper' require 'rspec-puppet-facts' -begin - require 'spec_helper_local' if File.file?(File.join(File.dirname(__FILE__), 'spec_helper_local.rb')) -rescue LoadError => loaderror - warn "Could not require spec_helper_local: #{loaderror.message}" -end +require 'spec_helper_local' if File.file?(File.join(File.dirname(__FILE__), 'spec_helper_local.rb')) include RspecPuppetFacts @@ -14,15 +10,19 @@ default_facts = { facterversion: Facter.version, } -default_facts_path = File.expand_path(File.join(File.dirname(__FILE__), 'default_facts.yml')) -default_module_facts_path = File.expand_path(File.join(File.dirname(__FILE__), 'default_module_facts.yml')) +default_fact_files = [ + File.expand_path(File.join(File.dirname(__FILE__), 'default_facts.yml')), + File.expand_path(File.join(File.dirname(__FILE__), 'default_module_facts.yml')), +] -if File.exist?(default_facts_path) && File.readable?(default_facts_path) - default_facts.merge!(YAML.safe_load(File.read(default_facts_path))) -end +default_fact_files.each do |f| + next unless File.exist?(f) && File.readable?(f) && File.size?(f) -if File.exist?(default_module_facts_path) && File.readable?(default_module_facts_path) - default_facts.merge!(YAML.safe_load(File.read(default_module_facts_path))) + begin + default_facts.merge!(YAML.safe_load(File.read(f))) + rescue => e + RSpec.configuration.reporter.message "WARNING: Unable to load #{f}: #{e}" + end end RSpec.configure do |c| From 68fb4fa4981814b9ad7166a1ce489efe94d5051e Mon Sep 17 00:00:00 2001 From: Eimhin Laverty Date: Fri, 9 Nov 2018 10:36:19 +0000 Subject: [PATCH 17/17] (MODULES-8234) - Upgrade Oracle Java version to 8u192 --- manifests/oracle.pp | 16 +++--- spec/acceptance/install_spec.rb | 6 +-- spec/defines/oracle_spec.rb | 93 +++++++++++++++++---------------- 3 files changed, 59 insertions(+), 56 deletions(-) diff --git a/manifests/oracle.pp b/manifests/oracle.pp index 9df10ef..de99251 100644 --- a/manifests/oracle.pp +++ b/manifests/oracle.pp @@ -158,16 +158,16 @@ define java::oracle ( $release_hash = undef } '8' : { - $release_major = '8u181' - $release_minor = 'b13' - $install_path = "${java_se}1.8.0_181" - $release_hash = '96a7b8442fe848ef90c96a2fad6ed6d1' + $release_major = '8u192' + $release_minor = 'b12' + $install_path = "${java_se}1.8.0_192" + $release_hash = '750e1c8617c5452694857ad95c3ee230' } default : { - $release_major = '8u181' - $release_minor = 'b13' - $install_path = "${java_se}1.8.0_181" - $release_hash = '96a7b8442fe848ef90c96a2fad6ed6d1' + $release_major = '8u192' + $release_minor = 'b12' + $install_path = "${java_se}1.8.0_192" + $release_hash = '750e1c8617c5452694857ad95c3ee230' } } } diff --git a/spec/acceptance/install_spec.rb b/spec/acceptance/install_spec.rb index 8891594..527ee58 100644 --- a/spec/acceptance/install_spec.rb +++ b/spec/acceptance/install_spec.rb @@ -87,9 +87,9 @@ bogus_alternative = "class { 'java':\n"\ oracle_enabled = false oracle_version_major = '8' -oracle_version_minor = '181' -oracle_version_build = '13' -oracle_hash = '96a7b8442fe848ef90c96a2fad6ed6d1' +oracle_version_minor = '192' +oracle_version_build = '12' +oracle_hash = '750e1c8617c5452694857ad95c3ee230' install_oracle_jre = < 'present', - version_major => '8u131', - version_minor => 'b11', + version_major => '8u121', + version_minor => 'b13', java_se => 'jdk', url_hash => 'abcdef01234567890', } @@ -168,9 +171,9 @@ describe 'java::oracle', type: :define do let(:params) { { ensure: 'present', version: '8', java_se: 'jdk' } } let(:title) { 'jdk8' } - it { is_expected.to contain_archive('/tmp/jdk-8u181-linux-i586.rpm') } - it { is_expected.to contain_exec('Install Oracle java_se jdk 8 8u181 b13').with_command('rpm --force -iv /tmp/jdk-8u181-linux-i586.rpm') } - it { is_expected.to contain_exec('Install Oracle java_se jdk 8 8u181 b13').that_requires('Archive[/tmp/jdk-8u181-linux-i586.rpm]') } + it { is_expected.to contain_archive('/tmp/jdk-8u192-linux-i586.rpm') } + it { is_expected.to contain_exec('Install Oracle java_se jdk 8 8u192 b12').with_command('rpm --force -iv /tmp/jdk-8u192-linux-i586.rpm') } + it { is_expected.to contain_exec('Install Oracle java_se jdk 8 8u192 b12').that_requires('Archive[/tmp/jdk-8u192-linux-i586.rpm]') } end context 'when selecting Oracle Java SE 6 JRE on RedHat family, 32-bit' do @@ -195,19 +198,19 @@ describe 'java::oracle', type: :define do let(:params) { { ensure: 'present', version: '8', java_se: 'jre' } } let(:title) { 'jdk8' } - it { is_expected.to contain_archive('/tmp/jre-8u181-linux-i586.rpm') } - it { is_expected.to contain_exec('Install Oracle java_se jre 8 8u181 b13').with_command('rpm --force -iv /tmp/jre-8u181-linux-i586.rpm') } - it { is_expected.to contain_exec('Install Oracle java_se jre 8 8u181 b13').that_requires('Archive[/tmp/jre-8u181-linux-i586.rpm]') } + it { is_expected.to contain_archive('/tmp/jre-8u192-linux-i586.rpm') } + it { is_expected.to contain_exec('Install Oracle java_se jre 8 8u192 b12').with_command('rpm --force -iv /tmp/jre-8u192-linux-i586.rpm') } + it { is_expected.to contain_exec('Install Oracle java_se jre 8 8u192 b12').that_requires('Archive[/tmp/jre-8u192-linux-i586.rpm]') } end context 'when installing multiple versions' do let(:params) do { ensure: 'present', - version_major: '8u181', - version_minor: 'b13', + version_major: '8u192', + version_minor: 'b12', java_se: 'jdk', - url_hash: '96a7b8442fe848ef90c96a2fad6ed6d1', + url_hash: '750e1c8617c5452694857ad95c3ee230', } end let(:title) { 'jdk8' } @@ -217,8 +220,8 @@ describe 'java::oracle', type: :define do java::oracle { 'jdk8121': ensure => 'present', - version_major => '8u131', - version_minor => 'b11', + version_major => '8u121', + version_minor => 'b13', java_se => 'jdk', url_hash => 'abcdef01234567890', } @@ -274,9 +277,9 @@ describe 'java::oracle', type: :define do let(:params) { { ensure: 'present', version: '8', java_se: 'jdk' } } let(:title) { 'jdk8' } - it { is_expected.to contain_archive('/tmp/jdk-8u181-linux-x64.tar.gz') } - it { is_expected.to contain_exec('Install Oracle java_se jdk 8 8u181 b13').with_command('tar -zxf /tmp/jdk-8u181-linux-x64.tar.gz -C /usr/lib/jvm') } - it { is_expected.to contain_exec('Install Oracle java_se jdk 8 8u181 b13').that_requires('Archive[/tmp/jdk-8u181-linux-x64.tar.gz]') } + it { is_expected.to contain_archive('/tmp/jdk-8u192-linux-x64.tar.gz') } + it { is_expected.to contain_exec('Install Oracle java_se jdk 8 8u192 b12').with_command('tar -zxf /tmp/jdk-8u192-linux-x64.tar.gz -C /usr/lib/jvm') } + it { is_expected.to contain_exec('Install Oracle java_se jdk 8 8u192 b12').that_requires('Archive[/tmp/jdk-8u192-linux-x64.tar.gz]') } end context 'with Oracle Java SE 6 JRE' do @@ -301,26 +304,26 @@ describe 'java::oracle', type: :define do let(:params) { { ensure: 'present', version: '8', java_se: 'jre' } } let(:title) { 'jre8' } - it { is_expected.to contain_archive('/tmp/jre-8u181-linux-x64.tar.gz') } - it { is_expected.to contain_exec('Install Oracle java_se jre 8 8u181 b13').with_command('tar -zxf /tmp/jre-8u181-linux-x64.tar.gz -C /usr/lib/jvm') } - it { is_expected.to contain_exec('Install Oracle java_se jre 8 8u181 b13').that_requires('Archive[/tmp/jre-8u181-linux-x64.tar.gz]') } + it { is_expected.to contain_archive('/tmp/jre-8u192-linux-x64.tar.gz') } + it { is_expected.to contain_exec('Install Oracle java_se jre 8 8u192 b12').with_command('tar -zxf /tmp/jre-8u192-linux-x64.tar.gz -C /usr/lib/jvm') } + it { is_expected.to contain_exec('Install Oracle java_se jre 8 8u192 b12').that_requires('Archive[/tmp/jre-8u192-linux-x64.tar.gz]') } end context 'when passing URL to url parameter' do - let(:params) { { ensure: 'present', version_major: '8u181', version_minor: 'b13', java_se: 'jdk', url: oracle_url.to_s } } + let(:params) { { ensure: 'present', version_major: '8u192', version_minor: 'b12', java_se: 'jdk', url: oracle_url.to_s } } let(:title) { 'jdk8' } - it { is_expected.to contain_archive('/tmp/jdk-8u181-linux-x64.tar.gz') } + it { is_expected.to contain_archive('/tmp/jdk-8u192-linux-x64.tar.gz') } end context 'when installing multiple versions' do let(:params) do { ensure: 'present', - version_major: '8u181', - version_minor: 'b13', + version_major: '8u192', + version_minor: 'b12', java_se: 'jdk', - url_hash: '96a7b8442fe848ef90c96a2fad6ed6d1', + url_hash: '750e1c8617c5452694857ad95c3ee230', } end let(:title) { 'jdk8' } @@ -330,8 +333,8 @@ describe 'java::oracle', type: :define do java::oracle { 'jdk8121': ensure => 'present', - version_major => '8u131', - version_minor => 'b11', + version_major => '8u121', + version_minor => 'b13', java_se => 'jdk', url_hash => 'abcdef01234567890', }