From f87c86ec115106ed9903972f3a03da93c5debefb Mon Sep 17 00:00:00 2001 From: rajat-puppet Date: Wed, 20 Sep 2023 22:16:45 +0530 Subject: [PATCH 1/2] Removing RedHat/Scientific/OracleLinux 6 --- README.md | 15 ++++--- manifests/params.pp | 13 +------ spec/classes/java_spec.rb | 73 ++--------------------------------- spec/defines/adopt_spec.rb | 2 +- spec/defines/adoptium_spec.rb | 2 +- spec/defines/download_spec.rb | 2 +- spec/defines/sap_spec.rb | 2 +- 7 files changed, 16 insertions(+), 93 deletions(-) diff --git a/README.md b/README.md index 4877fd25..82414c02 100644 --- a/README.md +++ b/README.md @@ -239,19 +239,18 @@ This module is officially [supported](https://forge.puppetlabs.com/supported) fo OpenJDK is supported on: -* Red Hat Enterprise Linux (RHEL) 6, 7 -* CentOS 6, 7 -* Oracle Linux 6, 7 -* Scientific Linux 6 -* Debian 9 -* Ubuntu 18.04, 20.04 +* Red Hat Enterprise Linux (RHEL) 7, 8, 9 +* CentOS 7, 8 +* Oracle Linux 7 +* Debian 10, 11 +* Ubuntu 18.04, 20.04, 22.04 * Solaris 11 -* SLES 11, 12 +* SLES 12, 15 Oracle Java is supported on: -* CentOS 6 * CentOS 7 +* CentOS 8 * Red Hat Enterprise Linux (RHEL) 7 AdoptOpenJDK Java is supported on: diff --git a/manifests/params.pp b/manifests/params.pp index d60bb5ca..00120706 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -9,19 +9,8 @@ 'RedHat': { case $facts['os']['name'] { 'AlmaLinux', 'Rocky', 'RedHat', 'CentOS', 'OracleLinux', 'Scientific', 'OEL', 'SLC', 'CloudLinux': { - if (versioncmp($facts['os']['release']['full'], '5.0') < 0) { - $jdk_package = 'java-1.6.0-sun-devel' - $jre_package = 'java-1.6.0-sun' - $java_home = '/usr/lib/jvm/java-1.6.0-sun/jre/' - } - # See cde7046 for why >= 5.0 < 6.3 - elsif (versioncmp($facts['os']['release']['full'], '6.3') < 0) { - $jdk_package = 'java-1.6.0-openjdk-devel' - $jre_package = 'java-1.6.0-openjdk' - $java_home = '/usr/lib/jvm/java-1.6.0/' - } # See PR#160 / c8e46b5 for why >= 6.3 < 7.1 - elsif (versioncmp($facts['os']['release']['full'], '7.1') < 0) { + if (versioncmp($facts['os']['release']['full'], '7.1') < 0) { $jdk_package = 'java-1.7.0-openjdk-devel' $jre_package = 'java-1.7.0-openjdk' $java_home = '/usr/lib/jvm/java-1.7.0/' diff --git a/spec/classes/java_spec.rb b/spec/classes/java_spec.rb index 61f357fb..09906916 100644 --- a/spec/classes/java_spec.rb +++ b/spec/classes/java_spec.rb @@ -3,20 +3,6 @@ require 'spec_helper' describe 'java', type: :class do - context 'when selecting openjdk for CentOS 5.8' do - let(:facts) { { os: { family: 'RedHat', name: 'CentOS', release: { full: '5.8' }, architecture: 'x86_64' } } } - - it { is_expected.to contain_package('java').with_name('java-1.6.0-openjdk-devel') } - it { is_expected.to contain_file_line('java-home-environment').with_line('JAVA_HOME=/usr/lib/jvm/java-1.6.0/') } - end - - context 'when selecting openjdk for CentOS 6.3' do - let(:facts) { { os: { family: 'RedHat', name: 'CentOS', release: { full: '6.3' }, architecture: 'x86_64' } } } - - it { is_expected.to contain_package('java').with_name('java-1.7.0-openjdk-devel') } - it { is_expected.to contain_file_line('java-home-environment').with_line('JAVA_HOME=/usr/lib/jvm/java-1.7.0/') } - end - context 'when selecting openjdk for CentOS 7.1.1503' do let(:facts) { { os: { family: 'RedHat', name: 'CentOS', release: { full: '7.1.1503' }, architecture: 'x86_64' } } } @@ -24,51 +10,6 @@ it { is_expected.to contain_file_line('java-home-environment').with_line('JAVA_HOME=/usr/lib/jvm/java-1.8.0/') } end - context 'when selecting openjdk for CentOS 6.2' do - let(:facts) { { os: { family: 'RedHat', name: 'CentOS', release: { full: '6.2' }, architecture: 'x86_64' } } } - - it { is_expected.to contain_package('java').with_name('java-1.6.0-openjdk-devel') } - it { is_expected.not_to contain_exec('update-java-alternatives') } - end - - context 'when selecting Oracle JRE with alternatives for CentOS 6.3' do - let(:facts) { { os: { family: 'RedHat', name: 'CentOS', release: { full: '6.3' }, architecture: 'x86_64' } } } - let(:params) { { 'package' => 'jre', 'java_alternative' => '/usr/bin/java', 'java_alternative_path' => '/usr/java/jre1.7.0_67/bin/java' } } - - it { is_expected.to contain_package('java').with_name('jre') } - - it { - expect(subject).to contain_exec('create-java-alternatives').with( - { command: ['alternatives', '--install', '/usr/bin/java', 'java', '/usr/java/jre1.7.0_67/bin/java', '20000'], - unless: 'alternatives --display java | grep -q /usr/java/jre1.7.0_67/bin/java' }, - ) - } - - it { is_expected.to contain_exec('update-java-alternatives').with_command(['alternatives', '--set', 'java', '/usr/java/jre1.7.0_67/bin/java']) } - end - - context 'when selecting Malicious JRE with alternatives for CentOS 6.3' do - let(:facts) { { os: { family: 'RedHat', name: 'CentOS', release: { full: '6.3' }, architecture: 'x86_64' } } } - let(:params) { { 'package' => 'jre', 'java_alternative' => '/usr/bin/java', 'java_alternative_path' => '/usr/java ; rm -rf /etc' } } - - it { is_expected.to contain_exec('create-java-alternatives').with_unless('alternatives --display java | grep -q /usr/java\\ \\;\\ rm\\ -rf\\ /etc') } - end - - context 'when selecting passed value for CentOS 5.3' do - let(:facts) { { os: { family: 'RedHat', name: 'CentOS', release: { full: '5.3' }, architecture: 'x86_64' } } } - let(:params) { { 'package' => 'jdk', 'java_home' => '/usr/local/lib/jre' } } - - it { is_expected.to contain_package('java').with_name('jdk') } - it { is_expected.not_to contain_exec('update-java-alternatives') } - end - - context 'when selecting default for CentOS 5.3' do - let(:facts) { { os: { family: 'RedHat', name: 'CentOS', release: { full: '5.3' }, architecture: 'x86_64' } } } - - it { is_expected.to contain_package('java').with_name('java-1.6.0-openjdk-devel') } - it { is_expected.not_to contain_exec('update-java-alternatives') } - end - context 'when selecting jdk for Debian Buster (10.0)' do let(:facts) { { os: { family: 'Debian', name: 'Debian', lsb: { distcodename: 'buster' }, release: { major: '10' }, architecture: 'amd64' } } } let(:params) { { 'distribution' => 'jdk' } } @@ -102,26 +43,20 @@ end context 'when selecting openjdk for Oracle Linux' do - let(:facts) { { os: { family: 'RedHat', name: 'OracleLinux', release: { full: '6.4' }, architecture: 'x86_64' } } } + let(:facts) { { os: { family: 'RedHat', name: 'OracleLinux', release: { full: '7.0' }, architecture: 'x86_64' } } } it { is_expected.to contain_package('java').with_name('java-1.7.0-openjdk-devel') } end - context 'when selecting openjdk for Oracle Linux 6.2' do - let(:facts) { { os: { family: 'RedHat', name: 'OracleLinux', release: { full: '6.2' }, architecture: 'x86_64' } } } - - it { is_expected.to contain_package('java').with_name('java-1.6.0-openjdk-devel') } - end - context 'when selecting passed value for Oracle Linux' do - let(:facts) { { os: { family: 'RedHat', name: 'OracleLinux', release: { full: '6.3' }, architecture: 'x86_64' } } } + let(:facts) { { os: { family: 'RedHat', name: 'OracleLinux', release: { full: '7.0' }, architecture: 'x86_64' } } } let(:params) { { 'distribution' => 'jre' } } it { is_expected.to contain_package('java').with_name('java-1.7.0-openjdk') } end context 'when selecting passed value for Scientific Linux' do - let(:facts) { { os: { family: 'RedHat', name: 'Scientific', release: { full: '6.4' }, architecture: 'x86_64' } } } + let(:facts) { { os: { family: 'RedHat', name: 'Scientific', release: { full: '7.0' }, architecture: 'x86_64' } } } let(:params) { { 'distribution' => 'jre' } } it { is_expected.to contain_package('java').with_name('java-1.7.0-openjdk') } @@ -129,7 +64,7 @@ end context 'when selecting passed value for Scientific Linux CERN (SLC)' do - let(:facts) { { os: { family: 'RedHat', name: 'SLC', release: { full: '6.4' }, architecture: 'x86_64' } } } + let(:facts) { { os: { family: 'RedHat', name: 'SLC', release: { full: '7.0' }, architecture: 'x86_64' } } } let(:params) { { 'distribution' => 'jre' } } it { is_expected.to contain_package('java').with_name('java-1.7.0-openjdk') } diff --git a/spec/defines/adopt_spec.rb b/spec/defines/adopt_spec.rb index 1d97a0c7..c56fc48a 100644 --- a/spec/defines/adopt_spec.rb +++ b/spec/defines/adopt_spec.rb @@ -4,7 +4,7 @@ describe 'java::adopt', type: :define do context 'with CentOS 64-bit' do - let(:facts) { { kernel: 'Linux', os: { family: 'RedHat', architecture: 'x86_64', name: 'CentOS', release: { full: '6.0' } } } } + let(:facts) { { kernel: 'Linux', os: { family: 'RedHat', architecture: 'x86_64', name: 'CentOS', release: { full: '7.0' } } } } context 'when manage_symlink is set to true' do let(:params) do diff --git a/spec/defines/adoptium_spec.rb b/spec/defines/adoptium_spec.rb index ba268912..94fb2ca3 100644 --- a/spec/defines/adoptium_spec.rb +++ b/spec/defines/adoptium_spec.rb @@ -4,7 +4,7 @@ describe 'java::adoptium', type: :define do context 'with CentOS 64-bit' do - let(:facts) { { kernel: 'Linux', os: { family: 'RedHat', architecture: 'x86_64', name: 'CentOS', release: { full: '6.0' } } } } + let(:facts) { { kernel: 'Linux', os: { family: 'RedHat', architecture: 'x86_64', name: 'CentOS', release: { full: '7.0' } } } } context 'when manage_symlink is set to true' do let(:params) do diff --git a/spec/defines/download_spec.rb b/spec/defines/download_spec.rb index 42a4f4d0..c6b8e7a6 100644 --- a/spec/defines/download_spec.rb +++ b/spec/defines/download_spec.rb @@ -6,7 +6,7 @@ let(:url) { 'http://download.oracle.com/otn-pub/java/jdk/8u201-b09/42970487e3af4f5aa5bca3f542482c60/jdk-8u201-linux-x64.tar.gz' } context 'with CentOS 64-bit' do - let(:facts) { { kernel: 'Linux', os: { family: 'RedHat', architecture: 'x86_64', name: 'CentOS', release: { full: '6.0' } } } } + let(:facts) { { kernel: 'Linux', os: { family: 'RedHat', architecture: 'x86_64', name: 'CentOS', release: { full: '7.0' } } } } context 'when passing URL to url parameter' do let(:params) do diff --git a/spec/defines/sap_spec.rb b/spec/defines/sap_spec.rb index 3340f332..5f4f9945 100644 --- a/spec/defines/sap_spec.rb +++ b/spec/defines/sap_spec.rb @@ -4,7 +4,7 @@ describe 'java::sap', type: :define do context 'with CentOS 64-bit' do - let(:facts) { { kernel: 'Linux', os: { family: 'RedHat', architecture: 'x86_64', name: 'CentOS', release: { full: '6.0' } } } } + let(:facts) { { kernel: 'Linux', os: { family: 'RedHat', architecture: 'x86_64', name: 'CentOS', release: { full: '7.0' } } } } context 'when manage_symlink is set to true' do let(:params) do From c53e4e115b76e52e585ca31cf3ccaa56f6b7753c Mon Sep 17 00:00:00 2001 From: rajat-puppet Date: Thu, 21 Sep 2023 11:48:06 +0530 Subject: [PATCH 2/2] Removing Debian 9 --- manifests/params.pp | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/manifests/params.pp b/manifests/params.pp index 00120706..cfbaa289 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -62,22 +62,6 @@ default => $facts['os']['architecture'] } case $facts['os']['release']['major'] { - '9': { - $java = { - 'jdk' => { - 'package' => 'openjdk-8-jdk', - '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-${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}/", - }, - } - } '10', '11', '18.04', '18.10', '19.04', '19.10', '20.04', '22.04': { $java = { 'jdk' => {