saltstack / saltstack/salt

[FEATURE REQUEST] win_service.py add service failure actions

Open
#68,017 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Feature needs-triage
Dominant language
Python
Stars
15.7k
Forks
5.6k
Avg merge
2d 44m
Merged PRs (30d)
80

Description

Is your feature request related to a problem? Please describe.
I have many services, salt-minion included, that don't install with the failure options that I want. I have to manage this configuration outside of salt because win_service.modify doesn't have an argument for failure options

Describe the solution you'd like
Add an argument (or arguments) to win_service.modify that allow for the changing of the failure_actions.

Describe alternatives you've considered
Doing this outside of salt.

Additional context
This could be accomplished with something like:
if failure_action is not None:
failure_action = eval(failure_action)
if list(failure_action.keys()) == ['ResetPeriod', 'RebootMsg', 'Command', 'Actions']:
win32service.ChangeServiceConfig2(handle_svc, win32service.SERVICE_CONFIG_FAILURE_ACTIONS, failure_action)
changes["failure_action"] = failure_action
else:
changes["Warning"] = "failure_action: requires a dictionary containing: 'ResetPeriod', 'RebootMsg', 'Command', 'Actions'"

it also requires win32service.SERVICE_ALL_ACCESS when initializing handle_svc

Please Note
If this feature request would be considered a substantial change or addition, this should go through a SEP process here https://github.com/saltstack/salt-enhancement-proposals, instead of a feature request.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in win_service.py at win_service.modify and inspect how handle_svc is initialized and how existing configuration changes are reported. Read the referenced win32service failure-actions API and determine the input shape and access requirements; done means modify can accept and apply failure actions with appropriate validation or warnings.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
infrastructure
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.