mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 17:09:03 +00:00
Check if service exists first in service.status for mac
This commit is contained in:
parent
b2d52b93f3
commit
4bc902599c
@ -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