Skip to content

Commit

Permalink
Fix linux-2.6 in download URL for RPMs
Browse files Browse the repository at this point in the history
Starting with 9.0.5 Splunk changed the filename of the RPM. It no longer includes
"linux-2.6", thus we need to adapt to this change.
  • Loading branch information
siegy22 committed Mar 17, 2024
1 parent 57ee480 commit bf00948
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 4 deletions.
13 changes: 10 additions & 3 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,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': {
Expand All @@ -310,12 +317,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'
}
Expand Down Expand Up @@ -350,7 +357,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'
}
Expand Down
50 changes: 49 additions & 1 deletion spec/classes/enterprise_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit bf00948

Please sign in to comment.