Skip to content

Commit

Permalink
Merge pull request #576 from puppetlabs/CAT-1427-Removal-of-RedHat-Sc…
Browse files Browse the repository at this point in the history
…ientific-OracleLinux-6

[CAT-1427] : Removing RedHat/Scientific/OracleLinux 6
  • Loading branch information
Ramesh7 authored Sep 21, 2023
2 parents 042df4c + c53e4e1 commit c89d7cc
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 109 deletions.
15 changes: 7 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
29 changes: 1 addition & 28 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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/'
Expand Down Expand Up @@ -73,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' => {
Expand Down
73 changes: 4 additions & 69 deletions spec/classes/java_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,72 +3,13 @@
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' } } }

it { is_expected.to contain_package('java').with_name('java-1.8.0-openjdk-devel') }
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' } }
Expand Down Expand Up @@ -102,34 +43,28 @@
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') }
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 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') }
Expand Down
2 changes: 1 addition & 1 deletion spec/defines/adopt_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion spec/defines/adoptium_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion spec/defines/download_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion spec/defines/sap_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c89d7cc

Please sign in to comment.