Skip to content

Commit a764ccf

Browse files
committed
Add upgrade/version handling for splunkforwarder
- Change "ensure" to an explicit version (otherwise only the file in /opt/staging will be added when $version is bumped) - Extra handling of accepting the license - Limit `ensure => version` to RedHat, the 'dpkg' provider is not versionable, so only specify version on osfamily RedHat. `ensure => absent` for the ftr file might even completely replace `Exec['license_splunkforwarder']` eventually (untested, however)
1 parent d926bc9 commit a764ccf

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

manifests/forwarder.pp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,15 @@
174174
}
175175
}
176176

177+
# To make sure upgrades also don't ask for licensing
178+
# Cannot run before license_splunkforwarder (or that will fail)
179+
# Cannot run before the service is started (or that will complain about license)
180+
file { "${forwarder_dir}/ftr" :
181+
ensure => absent,
182+
require => Exec['license_splunkforwarder'],
183+
before => Service[$virtual_service],
184+
}
185+
177186
file { "${forwarder_confdir}/system/local/deploymentclient.conf":
178187
ensure => file,
179188
tag => 'splunk_forwarder',

manifests/params.pp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,14 @@
252252
$forwarder_pkg_src = "${src_root}/products/universalforwarder/releases/${version}/${forwarder_src_subdir}/${forwarder_src_pkg}"
253253
$create_password = true
254254

255-
$forwarder_pkg_ensure = 'installed'
255+
case $osfamily {
256+
'RedHat': {
257+
$forwarder_pkg_ensure = $version
258+
}
259+
default: {
260+
$forwarder_pkg_ensure = 'installed'
261+
}
262+
}
256263

257264
# A meta resource so providers know where splunk is installed:
258265
splunk_config { 'splunk':

0 commit comments

Comments
 (0)