mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-18 14:51:09 +00:00
fix service status setting
fixes #18687 as 'disabled' can be at the end of the output fixes #20228 by not falling back to init scripts when it is a user service
This commit is contained in:
@@ -370,8 +370,11 @@ def main():
|
||||
if rc == 0:
|
||||
enabled = True
|
||||
elif rc == 1:
|
||||
# if both init script and unit file exist stdout should have enabled/disabled, otherwise use rc entries
|
||||
if is_initd and (not out.startswith('disabled') or sysv_is_enabled(unit)):
|
||||
# if not a user service and both init script and unit file exist stdout should have enabled/disabled, otherwise use rc entries
|
||||
if not module.params['user'] and \
|
||||
is_initd and \
|
||||
(not out.strip().endswith('disabled') or sysv_is_enabled(unit)):
|
||||
|
||||
enabled = True
|
||||
|
||||
# default to current state
|
||||
|
||||
Reference in New Issue
Block a user