Merge pull request #49477 from Ch3LL/mac_status_test

Check if service exists first in service.status for mac
This commit is contained in:
Mike Place 2018-09-02 11:59:50 -06:00 committed by GitHub
commit 52279f2c2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -25,6 +25,7 @@ This module has support for services in the following locations.
from __future__ import absolute_import, unicode_literals, print_function
# Import python libs
import logging
import os
import re
@ -46,6 +47,8 @@ __func_alias__ = {
'list_': 'list',
}
log = logging.getLogger(__name__)
def __virtual__():
'''
@ -492,6 +495,12 @@ def status(name, sig=None, runas=None):
if sig:
return __salt__['status.pid'](sig)
try:
_get_service(name)
except CommandExecutionError as msg:
log.error(msg)
return ''
if not runas and _launch_agent(name):
runas = __utils__['mac_utils.console_user'](username=True)