mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #46464 from gtmanfred/orchestration
fix salt subset in orchestrator
This commit is contained in:
commit
7d822f9cec
5 changed files with 24 additions and 1 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
5
tests/integration/files/file/base/orch/subset.sls
Normal file
5
tests/integration/files/file/base/orch/subset.sls
Normal file
|
@ -0,0 +1,5 @@
|
|||
test subset:
|
||||
salt.state:
|
||||
- tgt: '*'
|
||||
- subset: 1
|
||||
- sls: test
|
3
tests/integration/files/file/base/test.sls
Normal file
3
tests/integration/files/file/base/test.sls
Normal file
|
@ -0,0 +1,3 @@
|
|||
test state:
|
||||
test.succeed_without_changes:
|
||||
- name: test
|
|
@ -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):
|
||||
|
|
Loading…
Add table
Reference in a new issue