diff --git a/manifests/params.pp b/manifests/params.pp index 7b3f1fbc..07134b54 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -298,6 +298,13 @@ default: { $package_provider = undef } # Don't define a $package_provider } + # Download URLs changed starting from 9.0.5 for RPMs. + # Splunk no longer includes "-linux-2.6-". + $linux_prefix = versioncmp($version, '9.0.5') ? { + default => '.', + -1 => '-linux-2.6-', + } + # Settings specific to an architecture as well as an OS family case "${facts['os']['family']} ${facts['os']['architecture']}" { 'RedHat i386': { @@ -306,12 +313,12 @@ $enterprise_package_name = 'splunk' } 'RedHat x86_64': { - $package_suffix = "${version}-${build}-linux-2.6-x86_64.rpm" + $package_suffix = "${version}-${build}${linux_prefix}x86_64.rpm" $forwarder_package_name = 'splunkforwarder' $enterprise_package_name = 'splunk' } 'RedHat ppc64le': { - $package_suffix = "${version}-${build}-linux-2.6-ppc64le.rpm" + $package_suffix = "${version}-${build}${linux_prefix}ppc64le.rpm" $forwarder_package_name = 'splunkforwarder' $enterprise_package_name = 'splunk' } @@ -346,7 +353,7 @@ $enterprise_package_name = 'splunk' } 'Suse x86_64': { - $package_suffix = "${version}-${build}-linux-2.6-x86_64.rpm" + $package_suffix = "${version}-${build}${linux_prefix}x86_64.rpm" $forwarder_package_name = 'splunkforwarder' $enterprise_package_name = 'splunk' } diff --git a/spec/classes/enterprise_spec.rb b/spec/classes/enterprise_spec.rb index 7bd12ef2..9da6db1e 100644 --- a/spec/classes/enterprise_spec.rb +++ b/spec/classes/enterprise_spec.rb @@ -39,7 +39,55 @@ end describe 'splunk::enterprise' do - context 'supported operating systems' do + context 'correct download URL' do + test_on = { + hardwaremodels: ['x86_64'], + supported_os: [ + { + 'operatingsystem' => 'RedHat', + 'operatingsystemrelease' => ['9'], + }, + ], + } + on_supported_os(test_on).each do |os, facts| + context "on #{os}" do + let(:facts) { facts } + + context 'when version is lower than 9.0.5' do + let(:pre_condition) do + "class { 'splunk::params': version => '9.0.0', build => 'build' }" + end + + it { + is_expected.to compile.with_all_deps + is_expected.to contain_class('splunk::enterprise').with(enterprise_package_src: 'https://download.splunk.com/products/splunk/releases/9.0.0/linux/splunk-9.0.0-build-linux-2.6-x86_64.rpm') + } + end + + context 'when version is 9.0.5' do + let(:pre_condition) do + "class { 'splunk::params': version => '9.0.5', build => 'build' }" + end + + it { + is_expected.to compile.with_all_deps + is_expected.to contain_class('splunk::enterprise').with(enterprise_package_src: 'https://download.splunk.com/products/splunk/releases/9.0.5/linux/splunk-9.0.5-build.x86_64.rpm') + } + end + + context 'when version is higher than 9.0.5' do + let(:pre_condition) do + "class { 'splunk::params': version => '9.1.0', build => 'build' }" + end + + it { + is_expected.to compile.with_all_deps + is_expected.to contain_class('splunk::enterprise').with(enterprise_package_src: 'https://download.splunk.com/products/splunk/releases/9.1.0/linux/splunk-9.1.0-build.x86_64.rpm') + } + end + end + end + on_supported_os.each do |os, facts| next if facts[:os]['name'] == 'windows' # Splunk Server not used supported on windows @@ -79,8 +127,7 @@ context 'with $facts[service_provider] == init and $splunk::params::version >= 7.2.2' do let(:facts) do - facts.merge(service_provider: 'init') - end + facts.merge(service_provider: 'init') end let(:pre_condition) do "class { 'splunk::params': version => '7.2.4.2' }" end