mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 14:22:46 +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:
|
if rc == 0:
|
||||||
enabled = True
|
enabled = True
|
||||||
elif rc == 1:
|
elif rc == 1:
|
||||||
# if both init script and unit file exist stdout should have enabled/disabled, otherwise use rc entries
|
# if not a user service and 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 module.params['user'] and \
|
||||||
|
is_initd and \
|
||||||
|
(not out.strip().endswith('disabled') or sysv_is_enabled(unit)):
|
||||||
|
|
||||||
enabled = True
|
enabled = True
|
||||||
|
|
||||||
# default to current state
|
# default to current state
|
||||||
|
|||||||
Reference in New Issue
Block a user