Merge pull request #295 from david22swan/FM-6963
[FM-6963] Removal of unsupported OS from java
This commit is contained in:
@@ -44,22 +44,12 @@
|
|||||||
{
|
{
|
||||||
"operatingsystem": "Scientific",
|
"operatingsystem": "Scientific",
|
||||||
"operatingsystemrelease": [
|
"operatingsystemrelease": [
|
||||||
"5",
|
|
||||||
"6"
|
"6"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"operatingsystem": "Fedora",
|
|
||||||
"operatingsystemrelease": [
|
|
||||||
"20",
|
|
||||||
"21",
|
|
||||||
"22"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"operatingsystem": "Debian",
|
"operatingsystem": "Debian",
|
||||||
"operatingsystemrelease": [
|
"operatingsystemrelease": [
|
||||||
"7",
|
|
||||||
"8",
|
"8",
|
||||||
"9"
|
"9"
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -3,8 +3,7 @@ require 'spec_helper_acceptance'
|
|||||||
# RedHat, CentOS, Scientific, Oracle prior to 5.0 : Sun Java JDK/JRE 1.6
|
# 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 5.0 < x < 6.3 : OpenJDK Java JDK/JRE 1.6
|
||||||
# RedHat, CentOS, Scientific, Oracle after 6.3 : OpenJDK Java JDK/JRE 1.7
|
# RedHat, CentOS, Scientific, Oracle after 6.3 : OpenJDK Java JDK/JRE 1.7
|
||||||
# Debian 5/6 & Ubuntu 10.04/11.04 : OpenJDK Java JDK/JRE 1.6 or Sun Java JDK/JRE 1.6
|
# Debian Jesse & Ubuntu 14.04 : OpenJDK Java JDK/JRE 1.7 or Oracle Java JDK/JRE 1.6
|
||||||
# Debian 7/Jesse & Ubuntu 12.04 - 14.04 : OpenJDK Java JDK/JRE 1.7 or Oracle Java JDK/JRE 1.6
|
|
||||||
# Solaris (what versions?) : Java JDK/JRE 1.7
|
# Solaris (what versions?) : Java JDK/JRE 1.7
|
||||||
# OpenSuSE : OpenJDK Java JDK/JRE 1.7
|
# OpenSuSE : OpenJDK Java JDK/JRE 1.7
|
||||||
# SLES : IBM Java JDK/JRE 1.6
|
# SLES : IBM Java JDK/JRE 1.6
|
||||||
@@ -33,17 +32,17 @@ java_class_jre = "class { 'java':\n"\
|
|||||||
|
|
||||||
java_class = "class { 'java': }"
|
java_class = "class { 'java': }"
|
||||||
|
|
||||||
sources = "file_line { 'non-free source':\n"\
|
_sources = "file_line { 'non-free source':\n"\
|
||||||
" path => '/etc/apt/sources.list',\n"\
|
" path => '/etc/apt/sources.list',\n"\
|
||||||
" match => \"deb http://osmirror.delivery.puppetlabs.net/debian/ ${::lsbdistcodename} main\",\n"\
|
" match => \"deb http://osmirror.delivery.puppetlabs.net/debian/ ${::lsbdistcodename} main\",\n"\
|
||||||
" line => \"deb http://osmirror.delivery.puppetlabs.net/debian/ ${::lsbdistcodename} main non-free\",\n"\
|
" line => \"deb http://osmirror.delivery.puppetlabs.net/debian/ ${::lsbdistcodename} main non-free\",\n"\
|
||||||
'}'
|
'}'
|
||||||
|
|
||||||
sun_jre = "class { 'java':\n"\
|
_sun_jre = "class { 'java':\n"\
|
||||||
" distribution => 'sun-jre',\n"\
|
" distribution => 'sun-jre',\n"\
|
||||||
'}'
|
'}'
|
||||||
|
|
||||||
sun_jdk = "class { 'java':\n"\
|
_sun_jdk = "class { 'java':\n"\
|
||||||
" distribution => 'sun-jdk',\n"\
|
" distribution => 'sun-jdk',\n"\
|
||||||
'}'
|
'}'
|
||||||
|
|
||||||
@@ -80,20 +79,9 @@ bogus_alternative = "class { 'java':\n"\
|
|||||||
" java_alternative_path => '/whatever',\n"\
|
" java_alternative_path => '/whatever',\n"\
|
||||||
'}'
|
'}'
|
||||||
|
|
||||||
def apply_manifest_wheezy_case(pp)
|
|
||||||
# With the version of java that ships with pe on debian wheezy, update-alternatives
|
|
||||||
# throws an error on the first run due to missing alternative for policytool. It still
|
|
||||||
# updates the alternatives for java
|
|
||||||
if fact('operatingsystem') == 'Debian' && fact('lsbdistcodename') == 'wheezy'
|
|
||||||
apply_manifest(pp)
|
|
||||||
else
|
|
||||||
apply_manifest(pp, catch_failures: true)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'installing java jre', unless: UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
|
context 'installing java jre', unless: UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
|
||||||
it 'installs jre' do
|
it 'installs jre' do
|
||||||
apply_manifest_wheezy_case(java_class_jre)
|
apply_manifest(java_class_jre, catch_failures: true)
|
||||||
apply_manifest(java_class_jre, catch_changes: true)
|
apply_manifest(java_class_jre, catch_changes: true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -105,34 +93,10 @@ context 'installing java jdk', unless: UNSUPPORTED_PLATFORMS.include?(fact('osfa
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# C14686
|
|
||||||
context 'sun', if: (fact('operatingsystem') == 'Debian' && fact('operatingsystemrelease').match(%r{(5|6)})) do
|
|
||||||
before :all do
|
|
||||||
apply_manifest(sources)
|
|
||||||
shell('apt-get update')
|
|
||||||
shell('echo "sun-java6-jdk shared/accepted-sun-dlj-v1-1 select true" | debconf-set-selections')
|
|
||||||
shell('echo "sun-java6-jre shared/accepted-sun-dlj-v1-1 select true" | debconf-set-selections')
|
|
||||||
end
|
|
||||||
describe 'jre' do
|
|
||||||
it 'installs sun-jre' do
|
|
||||||
apply_manifest(sun_jre, catch_failures: true)
|
|
||||||
apply_manifest(sun_jre, catch_changes: true)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
describe 'jdk' do
|
|
||||||
it 'installs sun-jdk' do
|
|
||||||
apply_manifest(sun_jdk, catch_failures: true)
|
|
||||||
apply_manifest(sun_jdk, catch_changes: true)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# C14704
|
# C14704
|
||||||
# C14705
|
# C14705
|
||||||
# C15006
|
# C15006
|
||||||
context 'oracle', if: (
|
context 'oracle', if: (
|
||||||
(fact('operatingsystem') == 'Debian') && fact('operatingsystemrelease').match(%r{^7}) ||
|
|
||||||
(fact('operatingsystem') == 'Ubuntu') && fact('operatingsystemrelease').match(%r{^12\.04}) ||
|
|
||||||
(fact('operatingsystem') == 'Ubuntu') && fact('operatingsystemrelease').match(%r{^14\.04})
|
(fact('operatingsystem') == 'Ubuntu') && fact('operatingsystemrelease').match(%r{^14\.04})
|
||||||
) do
|
) do
|
||||||
# not supported
|
# not supported
|
||||||
|
|||||||
@@ -38,43 +38,6 @@ describe 'java', type: :class do
|
|||||||
it { is_expected.to contain_exec('update-java-alternatives').with_command('alternatives --set java /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
|
end
|
||||||
|
|
||||||
context 'when select openjdk for Fedora 20' do
|
|
||||||
let(:facts) { { osfamily: 'RedHat', operatingsystem: 'Fedora', operatingsystemrelease: '20', 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-openjdk-x86_64/') }
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'when select openjdk for Fedora 21' do
|
|
||||||
let(:facts) { { osfamily: 'RedHat', operatingsystem: 'Fedora', operatingsystemrelease: '21', 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-openjdk-x86_64/') }
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'when select passed value for Fedora 20' do
|
|
||||||
let(:facts) { { osfamily: 'RedHat', operatingsystem: 'Fedora', operatingsystemrelease: '20', architecture: 'x86_64' } }
|
|
||||||
let(:params) { { 'distribution' => 'jre', 'java_home' => '/usr/local/lib/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/local/lib/jre/') }
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'when select passed value for Fedora 21' do
|
|
||||||
let(:facts) { { osfamily: 'RedHat', operatingsystem: 'Fedora', operatingsystemrelease: '21', architecture: 'x86_64' } }
|
|
||||||
let(:params) { { 'distribution' => 'jre', 'java_home' => '/usr/local/lib/jre/' } }
|
|
||||||
|
|
||||||
it { is_expected.to contain_package('java').with_name('java-1.8.0-openjdk') }
|
|
||||||
it { is_expected.to contain_file_line('java-home-environment').with_line('JAVA_HOME=/usr/local/lib/jre/') }
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'when select passed value for Fedora 21 with yum option' do
|
|
||||||
let(:facts) { { osfamily: 'RedHat', operatingsystem: 'Fedora', operatingsystemrelease: '21', architecture: 'x86_64' } }
|
|
||||||
let(:params) { { 'distribution' => 'jre', 'package_options' => ['--skip-broken'] } }
|
|
||||||
|
|
||||||
it { is_expected.to contain_package('java') }
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'when select passed value for Centos 5.3' do
|
context 'when select passed value for Centos 5.3' do
|
||||||
let(:facts) { { osfamily: 'RedHat', operatingsystem: 'Centos', operatingsystemrelease: '5.3', architecture: 'x86_64' } }
|
let(:facts) { { osfamily: 'RedHat', operatingsystem: 'Centos', operatingsystemrelease: '5.3', architecture: 'x86_64' } }
|
||||||
let(:params) { { 'package' => 'jdk', 'java_home' => '/usr/local/lib/jre' } }
|
let(:params) { { 'package' => 'jdk', 'java_home' => '/usr/local/lib/jre' } }
|
||||||
@@ -90,81 +53,6 @@ describe 'java', type: :class do
|
|||||||
it { is_expected.not_to contain_exec('update-java-alternatives') }
|
it { is_expected.not_to contain_exec('update-java-alternatives') }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when select default for Debian Wheezy' do
|
|
||||||
let(:facts) { { osfamily: 'Debian', operatingsystem: 'Debian', lsbdistcodename: 'wheezy', operatingsystemrelease: '7.1', architecture: 'amd64' } }
|
|
||||||
|
|
||||||
it { is_expected.to contain_package('java').with_name('openjdk-7-jdk') }
|
|
||||||
it { is_expected.to contain_exec('update-java-alternatives').with_command('update-java-alternatives --set java-1.7.0-openjdk-amd64 --jre') }
|
|
||||||
it { is_expected.to contain_file_line('java-home-environment').with_line('JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-amd64/') }
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'when select Oracle JRE for Debian Wheezy' do
|
|
||||||
let(:facts) { { osfamily: 'Debian', operatingsystem: 'Debian', lsbdistcodename: 'wheezy', operatingsystemrelease: '7.1', architecture: 'amd64' } }
|
|
||||||
let(:params) { { 'distribution' => 'oracle-jre' } }
|
|
||||||
|
|
||||||
it { is_expected.to contain_package('java').with_name('oracle-j2re1.7') }
|
|
||||||
it { is_expected.to contain_exec('update-java-alternatives').with_command('update-java-alternatives --set j2re1.7-oracle --jre') }
|
|
||||||
it { is_expected.to contain_file_line('java-home-environment').with_line('JAVA_HOME=/usr/lib/jvm/j2re1.7-oracle/') }
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'when select Oracle Java 8 JRE >=u100 for Debian Wheezy' do
|
|
||||||
let(:facts) { { osfamily: 'Debian', operatingsystem: 'Debian', lsbdistcodename: 'wheezy', operatingsystemrelease: '7.1', architecture: 'amd64' } }
|
|
||||||
let(:params) { { 'distribution' => 'oracle-java8-jre' } }
|
|
||||||
|
|
||||||
it { is_expected.to contain_package('java').with_name('oracle-java8-jre') }
|
|
||||||
it { is_expected.to contain_exec('update-java-alternatives').with_command('update-java-alternatives --set jre-8-oracle-x64 --jre') }
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'when select Oracle Java 8 JDK >=u100 for Debian Wheezy' do
|
|
||||||
let(:facts) { { osfamily: 'Debian', operatingsystem: 'Debian', lsbdistcodename: 'wheezy', operatingsystemrelease: '7.1', architecture: 'amd64' } }
|
|
||||||
let(:params) { { 'distribution' => 'oracle-java8-jdk' } }
|
|
||||||
|
|
||||||
it { is_expected.to contain_package('java').with_name('oracle-java8-jdk') }
|
|
||||||
it { is_expected.to contain_exec('update-java-alternatives').with_command('update-java-alternatives --set jdk-8-oracle-x64 --jre') }
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'when select OpenJDK JRE for Debian Wheezy' do
|
|
||||||
let(:facts) { { osfamily: 'Debian', operatingsystem: 'Debian', lsbdistcodename: 'wheezy', operatingsystemrelease: '7.1', architecture: 'amd64' } }
|
|
||||||
let(:params) { { 'distribution' => 'jre' } }
|
|
||||||
|
|
||||||
it { is_expected.to contain_package('java').with_name('openjdk-7-jre-headless') }
|
|
||||||
it { is_expected.to contain_exec('update-java-alternatives').with_command('update-java-alternatives --set java-1.7.0-openjdk-amd64 --jre-headless') }
|
|
||||||
it { is_expected.to contain_file_line('java-home-environment').with_line('JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-amd64/') }
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'when select default for Debian Squeeze' do
|
|
||||||
let(:facts) { { osfamily: 'Debian', operatingsystem: 'Debian', lsbdistcodename: 'squeeze', operatingsystemrelease: '6.0.5', architecture: 'amd64' } }
|
|
||||||
|
|
||||||
it { is_expected.to contain_package('java').with_name('openjdk-6-jdk') }
|
|
||||||
it { is_expected.to contain_exec('update-java-alternatives').with_command('update-java-alternatives --set java-6-openjdk-amd64 --jre') }
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'when select Oracle JRE for Debian Squeeze' do
|
|
||||||
let(:facts) { { osfamily: 'Debian', operatingsystem: 'Debian', lsbdistcodename: 'squeeze', operatingsystemrelease: '6.0.5', architecture: 'amd64' } }
|
|
||||||
let(:params) { { 'distribution' => 'sun-jre' } }
|
|
||||||
|
|
||||||
it { is_expected.to contain_package('java').with_name('sun-java6-jre') }
|
|
||||||
it { is_expected.to contain_exec('update-java-alternatives').with_command('update-java-alternatives --set java-6-sun --jre') }
|
|
||||||
it { is_expected.to contain_file_line('java-home-environment').with_line('JAVA_HOME=/usr/lib/jvm/java-6-sun/jre/') }
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'when select OpenJDK JRE for Debian Squeeze' do
|
|
||||||
let(:facts) { { osfamily: 'Debian', operatingsystem: 'Debian', lsbdistcodename: 'squeeze', operatingsystemrelease: '6.0.5', architecture: 'amd64' } }
|
|
||||||
let(:params) { { 'distribution' => 'jre' } }
|
|
||||||
|
|
||||||
it { is_expected.to contain_package('java').with_name('openjdk-6-jre-headless') }
|
|
||||||
it { is_expected.to contain_exec('update-java-alternatives').with_command('update-java-alternatives --set java-6-openjdk-amd64 --jre-headless') }
|
|
||||||
it { is_expected.to contain_file_line('java-home-environment').with_line('JAVA_HOME=/usr/lib/jvm/java-6-openjdk/jre/') }
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'when select random alternative for Debian Wheezy' do
|
|
||||||
let(:facts) { { osfamily: 'Debian', operatingsystem: 'Debian', lsbdistcodename: 'wheezy', operatingsystemrelease: '7.1', architecture: 'amd64' } }
|
|
||||||
let(:params) { { 'java_alternative' => 'bananafish' } }
|
|
||||||
|
|
||||||
it { is_expected.to contain_package('java').with_name('openjdk-7-jdk') }
|
|
||||||
it { is_expected.to contain_exec('update-java-alternatives').with_command('update-java-alternatives --set bananafish --jre') }
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'when select jdk for Ubuntu Vivid (15.04)' do
|
context 'when select jdk for Ubuntu Vivid (15.04)' do
|
||||||
let(:facts) { { osfamily: 'Debian', operatingsystem: 'Ubuntu', lsbdistcodename: 'vivid', operatingsystemrelease: '15.04', architecture: 'amd64' } }
|
let(:facts) { { osfamily: 'Debian', operatingsystem: 'Ubuntu', lsbdistcodename: 'vivid', operatingsystemrelease: '15.04', architecture: 'amd64' } }
|
||||||
let(:params) { { 'distribution' => 'jdk' } }
|
let(:params) { { 'distribution' => 'jdk' } }
|
||||||
|
|||||||
Reference in New Issue
Block a user