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:
Brian Coca 2017-01-13 16:29:29 -05:00 committed by Brian Coca
parent 49e9d10f8e
commit 19496b5b73

View file

@ -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