-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
HI,
On 12/2/13 3:16 PM, Volker wrote:
>
> I see the command on the master, the syndic and the minion, etc.
> So that works. Doing the same over the salt-api still only works,
> if i put the minions key on the saltmaster AND the syndic.
>
i kept digging and finally found the solution/bug that is causing this
behaviour. It has nothing to do with salt-api, its a bug in
utils/minions.py combined with a new_job announcement on the eventbus
which is relevant for the localclient.
Here is how it happens:
The publisher receives a new job from the localclient (instantiated by
the rest_wsgi-application) with certain parameters. The publisher
takes the given parameters and tries to figure out, which minions are
expected to return something for this job.
The publisher does that, by using salt.utils.minions.check_minions()
with 'tgt' and 'expr_form' as parameters. In my case that is
'minion_id' (fqdn) and 'glob'.
Now utils.minions internally calls _check_glob_minions() which is
rather lazy and just does glob.glob() on the pki/master/minions
directory. Because my salt-api runs on a commanding saltmaster
(order_masters=true), there are no matching minion keys except the
syndic ones. That causes an empty list to be returned to the publisher
which then announces a new job on the eventbus with an empty minions list:
###
{'tag': '20131205231610337853', 'data': {'_stamp':
'2013-12-05_23:16:10.338119', 'minions': []}}
###
This does not yet break anything, because the publisher can handle an
empty minions list just fine.
Now we go back to the localclient which sits there and waits for the
published job to return something. After publishing a job, the
localclient tells itself to go to self.get_returns to wait for events
on a specific jid. The parameters for get_returns are the jid we
received from the publisher and wait for it... yes, the minion list we
also received from the publisher which is empty!
That makes the while-loop in get-returns break immediately and return
an empty result to the client because this always evaluates to true:
###
841 if len(found.intersection(minions)) >= len(minions):
842 # All minions have returned, break out of the loop
843 break
###
This can be easily tested by just touching the required minion-id in
the masters pki-directory. This also makes sense considering my
earlier findings where i put the minions key on the master and the
syndic to make it work.
@Seth: i have no idea why your test-setup works fine. It shouldnt have
if it looked like mine :-)
Fixing this:
The one thing i dont yet understand is, why this happens when i go
through the salt-api and not on the command line with eauth=pam.
I'll be happy to supply a patch. The thing is, im not sure how to
approach this until i figured out, whats the difference between the
localclient from cli and and the localclient from salt-api.
If anyone of the developers could enlighten me here on the last two
things, it would be highely appreciated.
- - volker
iEYEARECAAYFAlKhCOEACgkQHaTGAGocg2JCwACeMpZNYnL0YH/pg/e271Z9KJ1T
hscAnRSiPtUgkaZgFcUSaYOtPfSUigN1
=e1sE
-----END PGP SIGNATURE-----