service onestart on FreeBSD has unintended side effects for some packages
See original GitHub issueWith the package samba41 installed, running “service samba_server onestart” results in nmbd, smbd and winbindd to be started, even if winbindd_enable=“NO” in rc.conf which causes “service samba_server start” to normally not start winbindd.
On FreeBSD the service.running state uses onestart to start the service, presumably so it can start the service even if it is not enabled.
I’m not sure what the best practice for this is to solve it in a general case, but for instances where the service is defined as:
samba:
service.running:
- enable: True
There is no need to run onestart as long as the ‘enable’ step is done before the start step.
Likewise using “service samba_server onestatus” will always return 1 because it will check foro nmbd, smbd and winbindd’s status even if winbindd is disabled. Using onestop however shouldn’t cause any issues.
Issue Analytics
- State:
- Created 10 years ago
- Comments:16 (10 by maintainers)
Awesome! Thanks @sagetherage !
So note that there is already functionality to determine if a service is enabled - https://github.com/saltstack/salt/blob/0b2a5613b345f17339cb90e60b407199b3d26980/salt/modules/freebsdservice.py#L128
If the answer is yes, using start would fix this. If it’s not enabled then you’d have to fall back to onestart which has these side effects in some cases, but I imagine the most common case would be service.running with enable set to True so you’d be enabling it first if not already then starting the service.