New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pillar targeting broken #169
Comments
Hi @felskrone. Thanks for reporting this. Could you check if the following works: |
Two more questions @felskrone:
|
The command does not work. # salt-sproxy --preview-target -C "I@role:core"
No devices matched your target. Please review your tgt / tgt_type arguments, or the Roster data source Im using salt-sproxy only with the following roster. root@salt-gbone:~# cat /etc/salt/roster
cr-edge02.mydomain.com:
grains:
test: no
cr-edge01.mydomain.com:
grains:
test: no I had to specify the grains-section to get "salt-sproxy -G" working. But thats a different topic, just clarifying why its in there :) |
I you give me a good starting point on how to debug this further, i can take a look myself. Im pretty familiar with the salt-code base, just not the pillar stuff rendering. |
Hey @felskrone. Sorry for being late to this. One more thing to confirm: could you run the following, in this order, for me please:
With this information, I think I'll have a better idea what's the root issue. |
I think you should be good if you execute with |
Here we go. 1.
# salt-sproxy --preview-target -C "I@role:core" --invasive-targeting
- cr-edge02.mydomain.com
- cr-edge01.mydomain.com 2.
# salt-sproxy --preview-target -C "I@role:core"
- cr-edge01.mydomain.com 3.
# salt-sproxy \* test.ping --cache-grains --cache-pillar
cr-edge02.mydomain.com:
True
cr-edge01.mydomain.com:
True 4.
# salt-sproxy --preview-target -C "I@role:core"
- cr-edge01.mydomain.com This looks better, but not quite right.
But during testing this, i noticed that adding "role: core" to cr-edge02 did not reflect onto this commands. The output did not change. I had to manually remove cr-edge02's cache dir (/var/cache/salt/master/minions/cr-edge02.mydomain.com) to have it recreated with a "test.ping" to be able to use / see the newly added role. |
Thanks for confirming.
Yes, this is one of the caveats of not running active Minions, am not sure if there's a way to work around that. Open to suggestions though.
This one, however, is a bug probably. I've also noticed some strange behaviour sometimes with |
Hi there, sorry to hijack this thread but I have noticed the same behavior when adding or removing pillars:
Here is an example:
... and assigning it to the test host...
... the data is not available with pillar.get
It is available in pillar.items however. Running a command with
After removing the cache the data is available.
The same applies when removing pillar data as well. |
I see this also. --cache-{pillar,grains}, add an item into the pillar and nothing I do seems to ever refresh that cache/pillar with the new item. This included trying to force refresh the caches, with --cache-grains --cache-pillar again. This did not repopulate with the new information. Also deleting purely the pillar.p/grains.p files and force refreshing still didn't. There was also a data.p one level higher. Deleting the node's folder entirely and then --cache-grains --cache-pillar did the trick for re-populating and saving correctly. Delete the salt cache folder for this node and re-cache with a test.ping and it populates the new files correctly, which then lets me target using the new pillar item |
@biwhite @syntax-terr0r could you confirm what Salt versions are you running (a
I don't think there should also be both pillar.p + grains.p and data.p - sounds like a Salt bug... Out of curiosity, was either of those updated on |
This is the version I am running:
Just as an FYI, there was/is no data.p in my cache
|
@syntax-terr0r I can't reproduce your
|
That is very interesting. I just ran the test again with a dummy to make sure that it wasn't a fluke the first time around:
created a fresh top.sls with just the dummy, but no shared.test pillar yet
Making sure the dummy works and is cached:
pillar.items now shows:
Adding shared.test now:
result:
tried updating the cache, still no dice:
only after deleting the cache does it work
Just to make sure: |
Is anyone able to test #178 and confirm it fixes the issues you're all seeing? Cheers. |
That appears to have done it. Added another test pillar:
and the new data shows up without having to delete the cache:
|
Unfortunately I have noticed another issue since the fix in #178 I have a minion with the following grains:
However it seems that not all grain data is correctly processed and available in the sls files adding another test pillar:
results in:
The grains data for the model is not accessible/gone.
I'm relatively sure that this worked before because I also have pillar file in my top.sls which I assign based on Let me know if I should rather open a new issue for this or if it's related. |
It'd be great if you could check and update here. |
Ok, so I reverted the patch from #178 and it is still not working. It seems that the napalm grains (salt/grains/napalm.py) are only merged into the grains dict after the pillars have been rendered:
I have modified the test.sls like so
and these are the grains keys available at SLS rendering:
As you can see it's missing the following keys
which as far as I can see are all gathered in napalm.py But this is most likely a different issue than the one in this thread. |
Yes, @syntax-terr0r, that'd be a separate issue. @biwhite @felskrone would you also be able to confirm #178 solves the initial issue? |
Attempt to fix the caching issues from #169
Believe this should be fixed, but do reopen if you're still noticing the behaviour. |
Describe the bug
A Minion cant be targeted by using pillars.
Steps To Reproduce
A Minion has the role "core" assigned.
# salt-sproxy cr-edge* pillar.get role cr-edge01.mydomain.com: core
But it cant be targeted using -I parameter of salt-sproxy.
Expected behavior
The minion responds with "True".
Versions Report
Additional context
Pillar targeting is also not mentioned here: https://salt-sproxy.readthedocs.io/en/latest/targeting.html
But its part of the "salt-proxy -h" help. Is it generally supported?
The text was updated successfully, but these errors were encountered: