Merge pull request #46464 from gtmanfred/orchestration

fix salt subset in orchestrator
This commit is contained in:
Mike Place 2018-04-05 09:52:00 -05:00 committed by GitHub
commit 7d822f9cec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 24 additions and 1 deletions

View file

@ -481,6 +481,8 @@ class LocalClient(object):
following exceptions.
:param sub: The number of systems to execute on
:param cli: When this is set to True, a generator is returned,
otherwise a dictionary of the minion returns is returned
.. code-block:: python

View file

@ -1273,7 +1273,7 @@ def _exec(client, tgt, fun, arg, timeout, tgt_type, ret, kwarg, **kwargs):
_cmd = client.cmd_subset
cmd_kwargs = {
'tgt': tgt, 'fun': fun, 'arg': arg, 'tgt_type': tgt_type,
'ret': ret, 'kwarg': kwarg, 'sub': kwargs['subset'],
'ret': ret, 'cli': True, 'kwarg': kwarg, 'sub': kwargs['subset'],
}
del kwargs['subset']
else:

View file

@ -0,0 +1,5 @@
test subset:
salt.state:
- tgt: '*'
- subset: 1
- sls: test

View file

@ -0,0 +1,3 @@
test state:
test.succeed_without_changes:
- name: test

View file

@ -151,6 +151,19 @@ class StateRunnerTest(ShellCase):
server_thread.join()
def test_orchestrate_subset(self):
'''
test orchestration state using subset
'''
ret = self.run_run('state.orchestrate orch.subset')
def count(thing, listobj):
return sum([obj.strip() == thing for obj in listobj])
self.assertEqual(count('ID: test subset', ret), 1)
self.assertEqual(count('Succeeded: 1', ret), 1)
self.assertEqual(count('Failed: 0', ret), 1)
@skipIf(salt.utils.is_windows(), '*NIX-only test')
class OrchEventTest(ShellCase):