Return active running jobs on the master

* salt/runner.py::_run_runner was always returning {retcode: 70}. removed the else logic
* fixed some tests
This commit is contained in:
Austin Papp 2019-03-18 11:42:34 -04:00 committed by Daniel Wozniak
parent 4cb03eec2d
commit f6bd687819
3 changed files with 35 additions and 11 deletions

View file

@ -19,6 +19,7 @@ import salt.utils.args
import salt.utils.files
import salt.utils.jid
from salt.exceptions import SaltClientError
import salt.utils.master
# Import 3rd-party libs
from salt.ext import six
@ -33,6 +34,20 @@ except ImportError:
log = logging.getLogger(__name__)
def master():
'''
Return the actively executing runners for the master
CLI Example:
.. code-block:: bash
salt-run jobs.master
'''
jobs = salt.utils.master.get_running_jobs(__opts__)
return jobs
def active(display_progress=False):
"""
Return a report on all actively running jobs from a job id centric

View file

@ -14,12 +14,11 @@ from tests.support.unit import skipIf
log = logging.getLogger(__name__)
class ManageTest(ShellCase):
"""
Test the manage runner
"""
@skipIf(True, "SLOWTEST skip")
@skipIf(True, "SLOWTEST skip")
class CacheTest(ShellCase):
'''
Test the cache runner
'''
def test_cache(self):
"""
Store, list, fetch, then flush data

View file

@ -7,15 +7,25 @@ from __future__ import absolute_import, print_function, unicode_literals
import pytest
from tests.support.case import ShellCase
from tests.support.unit import skipIf
from tests.support.helpers import flaky
@pytest.mark.windows_whitelisted
class ManageTest(ShellCase):
"""
Test the manage runner
"""
@skipIf(True, "SLOWTEST skip")
class JobsTest(ShellCase):
'''
Test the jobs runner
'''
@skipIf(True, "SLOWTEST skip")
def test_master(self):
'''
jobs.master
'''
ret = self.run_run_plus('jobs.master')
self.assertEqual(ret['return'], [])
self.assertEqual(ret['out'], [])
@flaky
def test_active(self):
"""
jobs.active