Skip to content

Commit

Permalink
Merge pull request #49477 from Ch3LL/mac_status_test
Browse files Browse the repository at this point in the history
Check if service exists first in service.status for mac
  • Loading branch information
Mike Place committed Sep 2, 2018
2 parents b2d52b9 + 4bc9025 commit 52279f2
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions salt/modules/mac_service.py
Expand Up @@ -25,6 +25,7 @@
from __future__ import absolute_import, unicode_literals, print_function

# Import python libs
import logging
import os
import re

Expand All @@ -46,6 +47,8 @@
'list_': 'list',
}

log = logging.getLogger(__name__)


def __virtual__():
'''
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit 52279f2

Please sign in to comment.