salt icon indicating copy to clipboard operation
salt copied to clipboard

[FEATURE REQUEST] Add argument to salt.states.service.running to reset failed state

Open faivirol opened this issue 3 years ago • 3 comments

When restarting a service, and systemd's StartLimitIntervalSec is active (e.g. due to the service restarting too quickly recently), the state will not be able to restart the service. If a state fixes what is causing the restart loop and then attempts to restart the service too quickly, it will fail as the limit is still active. Running systemctl reset-failed before attempting to start the service works, which I would like to be able to run through an argument to the function.

I can try to implement this if you think this is a good solution.

faivirol avatar Jan 12 '23 09:01 faivirol

As it's a one-time intervention when you just fixed something, I don't think it's a good idea to have it as part of the state.

If you need it you can use cmd.run to do it.

OrangeDog avatar Jan 24 '23 14:01 OrangeDog

In my case, it is caused by a package's hook starting the service on install. Salt then configures the services and attempts to start it soon after it has hit StartLimitIntervalSec. I therefore hit this because the machine is new, not because I intervened.

Nevertheless, I get your point and agree that this would not make sense in most cases, so I'll close this. Thanks for your input!

faivirol avatar Jan 24 '23 14:01 faivirol

It's a bug in the package if it starts post-install despite not having working config.

OrangeDog avatar Jan 24 '23 15:01 OrangeDog