Wrong `minion_id` in matcher methods.
See original GitHub issueDescription of Issue
When filtering pillars with match.filter_by
, they don’t get matched correctly.
Reason is a wrong minion_id
in the matcher methods.
This bug was introduced in https://github.com/saltstack/salt/pull/48809/ , hence the question if that was somewhat intentional.
More specifically, it because of this deletion https://github.com/saltstack/salt/pull/48809/files#diff-889b4ad7294d8f45dfd1c3a87b9ba427L44
Can provide PR after clarification.
Setup
Any Setup with minion-filtered pillars, as described in https://docs.saltstack.com/en/latest/ref/modules/all/salt.modules.match.html
Steps to Reproduce Issue
Setup minion-filtered pillars as described in https://docs.saltstack.com/en/latest/ref/modules/all/salt.modules.match.html
Versions Report
Most of the 2019 versions, introduced with the PR https://github.com/saltstack/salt/pull/48809/
Issue Analytics
- State:
- Created 4 years ago
- Comments:13 (7 by maintainers)
We’re running into the same problem. Although getting
minion_id
from__opts__
should be a safe fallback fromgrains['id']
, the reality is that__opts__['minion_id']
actually contains a different minion’s name.That’s why the
pcre_match
keeps working andglob_match
broke down - the first one usesopts['id']
(which in our case contains the correct minion name), the other one uses__opts__['minion_id']
(which contains another minion’s name).I’m not sure how this is possible; my guess would be that
__opts__['minion_id']
is somehow, somewhere modified as a result of a race or thread unsafety.This problem goes away for a while after we restart the master. However, with 100% reproducibility, after we render the pillar on all minions (
salt --async '*' pillar.items
), the problem is back.FWIW, changing
minion_id = opts.get('minion_id', opts['id'])
tominion_id = opts['id']
inmatchers/glob_match.py
works around the problem (thus bypassing the incorrect value inopts['minion_id']
).