sous-chefs / chef-splunk

Development repository for the chef-splunk cookbook
https://supermarket.chef.io/cookbooks/chef-splunk
Apache License 2.0
75 stars 122 forks source link

Splunk restarting on every run because of mgmt port #213

Open yocally opened 3 years ago

yocally commented 3 years ago

:ghost: Brief Description

Every time the cookbook is run, Splunk is being restarted.

:pancakes: Cookbook version

Version: 7.2.1

:woman_cook: Chef-Infra Version

Version: 15.4.45

:tophat: Platform details

RHEL 8.4

Steps To Reproduce

It seems that any combination of options causes this, as long as Splunk is enabled.

:police_car: Expected behavior

update-splunk-mgmt-port would see that the management port does not need to be updated, and wouldn't update and restart.

:heavy_plus_sign: Additional context

I've run the same command used here to make sure the management port matches my configuration, and it does except for a leading whitespace, which I would assume is removed with the strip function. chef-client -l debug doesn't show the values that are being compared, so I'm not sure what's actually happening. I've also verified that my Splunk user's password doesn't contain spaces.

  * execute[update-splunk-mgmt-port] action run[2021-08-04T19:25:32+00:00] INFO: Processing execute[update-splunk-mgmt-port] action run (chef-splunk::server line 26)
Splunkd port: 8089

    [execute] The server's splunkd port has been changed.
              Restart the server with the command "splunk restart". Until the server restarts, many commands will fail with the error "splunkd is not running."
              You need to restart the Splunk Server (splunkd) for your changes to take effect.
[2021-08-04T19:25:33+00:00] INFO: execute[update-splunk-mgmt-port] ran successfully
    - execute su - splunk -c '/opt/splunk/bin/splunk set splunkd-port 8089 -auth '<redacted>:<redacted>''
[2021-08-04T19:25:34+00:00] INFO: execute[update-splunk-mgmt-port] sending restart action to service[splunk] (delayed)
[2021-08-04T19:25:34+00:00] INFO: service[splunk] running why-run restart action to support before action
Recipe: chef-splunk::service
  * service[splunk] action restart[2021-08-04T19:25:34+00:00] INFO: Processing service[splunk] action restart (chef-splunk::service line 101)
splunkd is running (PID: 411256).
splunk helpers are running (PIDs: 411308 411354 411485 411487 412018).
enabled

    * Service status not available. Assuming a prior action would have installed the service.
    * Assuming status of not running.
    - Would restart service service[splunk]