Rebase with master, fix conflicts and rubocop issues
This commit is contained in:
@@ -17,15 +17,11 @@ Facter.add(:java_libjvm_path) do
|
|||||||
java_default_home = Facter.value(:java_default_home)
|
java_default_home = Facter.value(:java_default_home)
|
||||||
java_major_version = Facter.value(:java_major_version)
|
java_major_version = Facter.value(:java_major_version)
|
||||||
unless java_major_version.nil?
|
unless java_major_version.nil?
|
||||||
if java_major_version.to_i >= 11
|
java_libjvm_file = if java_major_version.to_i >= 11
|
||||||
java_libjvm_file = Dir.glob("#{java_default_home}/lib/**/libjvm.so")
|
Dir.glob("#{java_default_home}/lib/**/libjvm.so")
|
||||||
if java_libjvm_file.nil? || java_libjvm_file.empty?
|
|
||||||
nil
|
|
||||||
else
|
else
|
||||||
File.dirname(java_libjvm_file[0])
|
Dir.glob("#{java_default_home}/jre/lib/**/libjvm.so")
|
||||||
end
|
end
|
||||||
else
|
|
||||||
java_libjvm_file = Dir.glob("#{java_default_home}/jre/lib/**/libjvm.so")
|
|
||||||
if java_libjvm_file.nil? || java_libjvm_file.empty?
|
if java_libjvm_file.nil? || java_libjvm_file.empty?
|
||||||
nil
|
nil
|
||||||
else
|
else
|
||||||
@@ -34,4 +30,3 @@ Facter.add(:java_libjvm_path) do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|||||||
@@ -17,10 +17,10 @@ Facter.add(:java_major_version) do
|
|||||||
setcode do
|
setcode do
|
||||||
java_version = Facter.value(:java_version)
|
java_version = Facter.value(:java_version)
|
||||||
unless java_version.nil?
|
unless java_version.nil?
|
||||||
if java_version.strip[0..1] == '1.'
|
java_major_version = if java_version.strip[0..1] == '1.'
|
||||||
java_major_version = java_version.strip.split('_')[0].split('.')[1]
|
java_version.strip.split('_')[0].split('.')[1]
|
||||||
else
|
else
|
||||||
java_major_version = java_version.strip.split('.')[0]
|
java_version.strip.split('.')[0]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
require 'spec_helper_acceptance'
|
require 'spec_helper_acceptance'
|
||||||
|
require 'pry'
|
||||||
|
|
||||||
java_class_jre = "class { 'java':\n"\
|
java_class_jre = "class { 'java':\n"\
|
||||||
" distribution => 'jre',\n"\
|
" distribution => 'jre',\n"\
|
||||||
@@ -41,7 +42,6 @@ bogus_alternative = "class { 'java':\n"\
|
|||||||
" java_alternative_path => '/whatever',\n"\
|
" java_alternative_path => '/whatever',\n"\
|
||||||
'}'
|
'}'
|
||||||
|
|
||||||
context 'installing java jre', unless: UNSUPPORTED_PLATFORMS.include?(os[:family]) do
|
|
||||||
# Oracle installs are disabled by default, because the links to valid oracle installations
|
# 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
|
# change often. Look the parameters up from the Oracle download URLs at https://java.oracle.com and
|
||||||
# enable the tests:
|
# enable the tests:
|
||||||
@@ -138,7 +138,7 @@ install_adopt_jdk_jre = <<EOL
|
|||||||
}
|
}
|
||||||
EOL
|
EOL
|
||||||
|
|
||||||
context 'installing java jre', unless: UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
|
context 'installing java jre', unless: UNSUPPORTED_PLATFORMS.include?(os[:family]) do
|
||||||
it 'installs jre' do
|
it 'installs jre' do
|
||||||
idempotent_apply(java_class_jre)
|
idempotent_apply(java_class_jre)
|
||||||
end
|
end
|
||||||
@@ -176,17 +176,17 @@ context 'with failure cases' do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'java::oracle', if: oracle_enabled, unless: UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
|
context 'java::oracle', if: oracle_enabled, unless: UNSUPPORTED_PLATFORMS.include?(os[:family]) do
|
||||||
let(:install_path) do
|
let(:install_path) do
|
||||||
(fact('osfamily') == 'RedHat') ? '/usr/java' : '/usr/lib/jvm'
|
(os[:family] == 'redhat') ? '/usr/java' : '/usr/lib/jvm'
|
||||||
end
|
end
|
||||||
|
|
||||||
let(:version_suffix) do
|
let(:version_suffix) do
|
||||||
(fact('osfamily') == 'RedHat') ? '-amd64' : ''
|
(os[:family] == 'redhat') ? '-amd64' : ''
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'installs oracle jdk and jre' do
|
it 'installs oracle jdk and jre' do
|
||||||
idempotent_apply(default, install_oracle_jdk_jre)
|
idempotent_apply(install_oracle_jdk_jre)
|
||||||
jdk_result = shell("test ! -e #{install_path}/jdk1.#{oracle_version_major}.0_#{oracle_version_minor}#{version_suffix}/jre/lib/security/local_policy.jar")
|
jdk_result = shell("test ! -e #{install_path}/jdk1.#{oracle_version_major}.0_#{oracle_version_minor}#{version_suffix}/jre/lib/security/local_policy.jar")
|
||||||
jre_result = shell("test ! -e #{install_path}/jre1.#{oracle_version_major}.0_#{oracle_version_minor}#{version_suffix}/lib/security/local_policy.jar")
|
jre_result = shell("test ! -e #{install_path}/jre1.#{oracle_version_major}.0_#{oracle_version_minor}#{version_suffix}/lib/security/local_policy.jar")
|
||||||
expect(jdk_result.exit_code).to eq(0)
|
expect(jdk_result.exit_code).to eq(0)
|
||||||
@@ -194,28 +194,28 @@ context 'java::oracle', if: oracle_enabled, unless: UNSUPPORTED_PLATFORMS.includ
|
|||||||
end
|
end
|
||||||
|
|
||||||
it 'installs oracle jdk with jce' do
|
it 'installs oracle jdk with jce' do
|
||||||
idempotent_apply(default, install_oracle_jdk_jce)
|
idempotent_apply(install_oracle_jdk_jce)
|
||||||
result = shell("test -e #{install_path}/jdk1.#{oracle_version_major}.0_#{oracle_version_minor}#{version_suffix}/jre/lib/security/local_policy.jar")
|
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)
|
expect(result.exit_code).to eq(0)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'installs oracle jre with jce' do
|
it 'installs oracle jre with jce' do
|
||||||
idempotent_apply(default, install_oracle_jre_jce)
|
idempotent_apply(install_oracle_jre_jce)
|
||||||
result = shell("test -e #{install_path}/jre1.#{oracle_version_major}.0_#{oracle_version_minor}#{version_suffix}/lib/security/local_policy.jar")
|
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)
|
expect(result.exit_code).to eq(0)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'java::adopt', if: adopt_enabled, unless: UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
|
context 'java::adopt', if: adopt_enabled, unless: UNSUPPORTED_PLATFORMS.include?(os[:family]) do
|
||||||
let(:install_path) do
|
let(:install_path) do
|
||||||
(fact('osfamily') == 'RedHat') ? '/usr/java' : '/usr/lib/jvm'
|
(os[:family] == 'redhat') ? '/usr/java' : '/usr/lib/jvm'
|
||||||
end
|
end
|
||||||
|
|
||||||
let(:version_suffix) do
|
let(:version_suffix) do
|
||||||
(fact('osfamily') == 'RedHat') ? '-amd64' : ''
|
(os[:family] == 'redhat') ? '-amd64' : ''
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'installs adopt jdk and jre' do
|
it 'installs adopt jdk and jre' do
|
||||||
idempotent_apply(default, install_adopt_jdk_jre)
|
idempotent_apply(install_adopt_jdk_jre)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user