Skip to content
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

Merged
merged 7 commits into from
Dec 16, 2024

Conversation

cjswart
Copy link
Contributor

@cjswart cjswart commented Nov 20, 2024

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

On windows we need to set delayed for the service
@kenyon kenyon changed the title Issue_383: Add ensure and enable parameter for forwarder service Issue #383: Add ensure and enable parameter for forwarder service Nov 20, 2024
@kenyon kenyon added the enhancement New feature or request label Nov 20, 2024
@@ -4,10 +4,15 @@
# sub-classes
#
class splunk::forwarder::service {
$provider = $facts['os']['family'] ? {
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

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

Copy link
Contributor Author

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

manifests/forwarder.pp Outdated Show resolved Hide resolved
@@ -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,
Copy link
Member

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?

Copy link
Contributor Author

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

Copy link
Contributor Author

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

manifests/params.pp Outdated Show resolved Hide resolved
removed the provider selector
update type validation service_ensure
removed service_ensure from params.pp
@kenyon kenyon merged commit a1a82eb into voxpupuli:master Dec 16, 2024
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a $service_enable param to splunk::forwarder::service
5 participants