mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 08:58:59 +00:00
Merge pull request #49477 from Ch3LL/mac_status_test
Check if service exists first in service.status for mac
This commit is contained in:
commit
52279f2c2e
@ -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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user