The thorium system is currently unable to invoke any runner (at all).
This is due to the fact that we go thorough the State system
which builds the "chunks" from the state-formatted data:
https://github.com/saltstack/salt/blob/develop/salt/thorium/__init__.py#L166
For example, the following Thorium state:
dummy:
runner.cmd
- fun: test.sleep
- kwargs:
s_time: 1
Will produce the following state chunks:
[{'name': 'dummy', 'state': 'runner', '__id__': 'dummy', 'kwargs': OrderedDict([('s_time', 1)]), 'fun': 'cmd', '__env__': 'base', '__sls__': u'dummy', 'order': 10000}]
The value of the `fun` field from the state chunks will override
the value specified in the Thorisum state. For the example above,
instead of execution the `test.sleep` runner function, it will
try instead to execute the `cmd` runner function, which will,
of course, fail.
In order to preserve the value of the actual function requested by
the user, we must rename `fun` to `func` to avoid this collision,
which is also in-line with the equivalent `local.cmd` for local
functions: https://github.com/saltstack/salt/blob/develop/salt/thorium/local.py#L14
The state chunks in this case will be:
[{'name': 'dummy', 'state': 'runner', '__id__': 'dummy', 'func': 'test.sleep', 'kwargs': OrderedDict([('s_time', 1)]), 'fun': 'cmd', '__env__': 'base', '__sls__': u'dummy', 'order': 10000}]
Which will correctly try to execute the requested runner function.
Similarly to the changes from #44549, we need to look under in a different
location when saving the static grains, so the grain file is, e.g.,
/etc/salt/proxy.d/{id}/grains.
This solves #42300.
Cherry-picked and squashed the two commits from the develop branch
(details at the end of this message)
The unit test module didn't exist at all on 2017.7, hence a conflict during
cherry picking, resolved by introducing only the new tests (the other ones
don't pass as is on 2017.7)
Also, the mock in unit tests for mine.get had to be adapted,
because the return of salt.utils.minions.CkMinions._check_compound_minions()
takes a different form on 2017.7 (just the list of minions).
Original cherry-picked commits:
commit 115ebef6a089dedf8dbadd3b4cca768adbb4a710
Author: Georges Racinet <gracinet@anybox.fr>
Date: Wed Nov 8 18:02:29 2017 +0100
Unit test for backwards compatibility of mine.get
Could not find calls to RemoteFuncs in unit tests, therefore started a
new one, hope it's in the appropriate place.
The test replaces the caceh by its own (very limited) one. It's quite
possible it could be improved by reusing another one meant for unit tests.
commit dc884478399355f3fbea8626a8366b933580dee0
Author: Georges Racinet <gracinet@anybox.fr>
Date: Mon Oct 30 13:49:13 2017 +0100
Backwards compat for mine.get on pre-Nitrogen minions
With this change, the master will accept `expr_form` from
its minions doing a `mine.get`, which is what minions versions
before Nitrogen would do. This solves issue #42713.
In case both `tgt_type` and `expr_form` are present, the former
gets precedence.
Performance-wise, this adds a single dict lookup for minions
running Nitrogen onwards, and two for pre-Nitrogen minions.
This is, in my opinion, acceptable.