modules.gentoo_service handle stopped retcode

In OpenRC, when a service is stopped, the retcode of /sbin/openrc-run is
3, not 0.
This commit is contained in:
Justin Findlay 2018-02-19 05:31:44 -08:00
parent c3a938e994
commit 81ec66fd8b
No known key found for this signature in database
GPG key ID: 423725EEF5A74B6F

View file

@ -37,9 +37,9 @@ def __virtual__():
'only available on Gentoo/Open-RC systems.')
def _ret_code(cmd):
def _ret_code(cmd, ignore_retcode=False):
log.debug('executing [{0}]'.format(cmd))
sts = __salt__['cmd.retcode'](cmd, python_shell=False)
sts = __salt__['cmd.retcode'](cmd, python_shell=False, ignore_retcode=ignore_retcode)
return sts
@ -248,8 +248,9 @@ def status(name, sig=None):
'''
if sig:
return bool(__salt__['status.pid'](sig))
cmd = _service_cmd(name, 'status')
return not _ret_code(cmd)
return not _ret_code(cmd, ignore_retcode=True)
def enable(name, **kwargs):