Skip to content

Commit 3ffec12

Browse files
authored
Merge pull request #334 from davemcdonnell/fix_permission_issues_310
Explicitly set user on call to 'splunk enable boot-start'
2 parents 028ed5d + ef9dc51 commit 3ffec12

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

manifests/forwarder/service/nix.pp

+3-5
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,9 @@
1818
timeout => 0,
1919
notify => Exec['enable_splunkforwarder'],
2020
}
21-
if $splunk::params::supports_systemd and $splunk::forwarder::splunk_user == 'root' {
22-
$user_args = ''
23-
} else {
24-
$user_args = "-user ${splunk::forwarder::splunk_user}"
25-
}
21+
22+
$user_args = "-user ${splunk::forwarder::splunk_user}"
23+
2624
# This will fail if the unit file already exists. Splunk does not remove
2725
# unit files during uninstallation, so you may be required to manually
2826
# remove existing unit files before re-installing and enabling boot-start.

spec/classes/forwarder_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@
112112
it { is_expected.to contain_class('splunk::forwarder::service::nix') }
113113
it { is_expected.to contain_class('splunk::forwarder').with(service_name: 'SplunkForwarder') }
114114
it { is_expected.to contain_exec('stop_splunkforwarder').with(command: '/opt/splunkforwarder/bin/splunk stop') }
115-
it { is_expected.to contain_exec('enable_splunkforwarder').with(command: '/opt/splunkforwarder/bin/splunk enable boot-start -systemd-managed 1 --accept-license --answer-yes --no-prompt') }
115+
it { is_expected.to contain_exec('enable_splunkforwarder').with(command: '/opt/splunkforwarder/bin/splunk enable boot-start -user root -systemd-managed 1 --accept-license --answer-yes --no-prompt') }
116116
it { is_expected.not_to contain_exec('disable_splunkforwarder') }
117117
it { is_expected.not_to contain_exec('license_splunkforwarder') }
118118
it { is_expected.to contain_service('SplunkForwarder').with(ensure: 'running', enable: true, status: nil, restart: nil, start: nil, stop: nil) }

0 commit comments

Comments
 (0)