mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Honor roster file for ssh orchestrations
This commit is contained in:
parent
c8db7e3751
commit
5e2db2f7af
2 changed files with 18 additions and 0 deletions
|
@ -284,6 +284,8 @@ def state(name,
|
|||
|
||||
cmd_kw['tgt_type'] = tgt_type
|
||||
cmd_kw['ssh'] = ssh
|
||||
if 'roster' in kwargs:
|
||||
cmd_kw['roster_file'] = kwargs['roster']
|
||||
cmd_kw['expect_minions'] = expect_minions
|
||||
if highstate:
|
||||
fun = 'state.highstate'
|
||||
|
|
|
@ -282,6 +282,22 @@ class SaltmodTestCase(TestCase, LoaderModuleMockMixin):
|
|||
with patch.dict(saltmod.__salt__, {'saltutil.wheel': wheel_mock}):
|
||||
self.assertDictEqual(saltmod.wheel(name), ret)
|
||||
|
||||
def test_state_ssh(self):
|
||||
'''
|
||||
Test saltmod passes roster to saltutil.cmd
|
||||
'''
|
||||
origcmd = saltmod.__salt__['saltutil.cmd']
|
||||
cmd_kwargs = {}
|
||||
cmd_args = []
|
||||
def cmd_mock(*args, **kwargs):
|
||||
cmd_args.extend(args)
|
||||
cmd_kwargs.update(kwargs)
|
||||
return origcmd(*args, **kwargs)
|
||||
with patch.dict(saltmod.__salt__, {'saltutil.cmd': cmd_mock}):
|
||||
ret = saltmod.state('state.sls', tgt='*', ssh=True, highstate=True, roster='my_roster')
|
||||
assert 'roster_file' in cmd_kwargs
|
||||
assert cmd_kwargs['roster_file'] == 'my_roster'
|
||||
|
||||
|
||||
@skipIf(NO_MOCK, NO_MOCK_REASON)
|
||||
class StatemodTests(TestCase, LoaderModuleMockMixin):
|
||||
|
|
Loading…
Add table
Reference in a new issue