-
-
Notifications
You must be signed in to change notification settings - Fork 124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue #383: Add ensure and enable parameter for forwarder service #390
Conversation
On windows we need to set delayed for the service
manifests/forwarder/service.pp
Outdated
@@ -4,10 +4,15 @@ | |||
# sub-classes | |||
# | |||
class splunk::forwarder::service { | |||
$provider = $facts['os']['family'] ? { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is that required? Did you run into any issues?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When running de rspec test locally (on an ubuntu 22.04 bundle exec rake spec) the test on windows fails with the error Provider redhat must have features 'delayed_startable'
I have no idea why the provider redhat was used for the service resource in the rspec test for windows but this seems to fix it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed the code and on puppet7 with ruby 2.7 it fails
Error: splunk::forwarder supported operating systems on windows-2012-x86_64 is expected to compile into a catalogue without dependency cycles
Failure/Error: it { is_expected.to compile.with_all_deps }
error during compilation: Parameter enable failed on Service[SplunkForwarder]: Provider redhat must have features 'delayed_startable' to set 'enable' to 'delayed' (file: /home/runner/work/puppet-splunk/puppet-splunk/spec/fixtures/modules/splunk/manifests/forwarder/service.pp, line: 7)
Do you have an other suggestion to fix this or shall i put the selector back in the code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed it by using $facts['service_provider'] as provider and add the fact to the rspec on windows
@@ -172,6 +178,8 @@ | |||
Stdlib::Absolutepath $forwarder_homedir = $splunk::params::forwarder_homedir, | |||
Stdlib::Absolutepath $forwarder_confdir = $splunk::params::forwarder_confdir, | |||
String[1] $service_name = $splunk::params::forwarder_service, | |||
String[1] $service_ensure = $splunk::params::forwarder_service_ensure, | |||
String[1] $service_enable = $splunk::params::forwarder_service_enable, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this be a boolean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think only the ensure is a boolean i shall test this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Service enable property has different values on different OS'en possible values are true, false, manual, mask or delayed
So it can not be a boolean
removed the provider selector update type validation service_ensure removed service_ensure from params.pp
On windows we need to set delayed for the service
Pull Request (PR) description
Issue_383: Make the ensure and enable parameter of the splunk forwarder service configurable
We need to set enable to delayed on windows servers
This Pull Request (PR) fixes the following issues
Fixes #383