Check if service exists first in service.status for mac

This commit is contained in:
Ch3LL 2018-08-31 17:12:10 -04:00
parent b2d52b93f3
commit 4bc902599c
No known key found for this signature in database
GPG Key ID: 132B55A7C13EFA73

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)