-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
[BUG] state.apply fails if pillar uses custom grain from _grains #65027
Comments
@bdrx312 Please retry the issue with the latest 3006.2, a number of fixes have been made since 3006.0 was released. |
I did not realize that 3006.2 was out already. I updated and tried again but got the same error. I will edit the post to put the update version info. |
@bdrx312 Tried this with Salt 3005.1 classic packaging and it failed, wondering if there is something missing in the instructions
Trying to ensure it used to work and now broken |
Also from a salt-master
root@Unknown:/srv/pillar# l
|
I added the salt minion configuration |
@bdrx312 Even in masterless with file_client local, I am still unale to reproduce this with Salt 3006.1, and do not see a SaltRenderError in the logs:
Can you reexamine the configurations on the minion in order to reproduce the issue you are experiencing ?, but so far I have been unable to reproduce the rendering error. |
I had a typo/mismatch in the file name of the pillar defaults file. In the pillar top file I specified |
So with the default.sls -> defaults.sls, and re-run
Update to Salt 3006.2 and same result, it works for me with Salt 3006.2 too
|
I just tried also on a fresh
|
@bdrx312 Will try that, but I was using a VirtualBox Debian 11 amd64, from cold start. And got
And the SaltRenderError in the logs. |
Running the saltutil.clear_cache removes the custom grain, however saltutil.sync_grains does return it and all works as it should. However, the documentation https://docs.saltproject.io/en/latest/topics/grains/index.html#syncing-grains, states that the state.highstate should automatically sync the grains, but that is not happening and getting the same failure as with state.apply. Also the custom grain is not getting rebuilt when the minion is restarted, e.g. systemctl restart salt-minion, as shown it is missing running grains.ls This problem is only related to _grains, custom grains in /etc/salt/grains appear fine. |
This appears to be a corner-case with masterless minion, since with the salt://_grains on a master, the problem does not happen, except after the following commands:
Appears misread the doc and minion restart doesn't sync _grains |
Well the issue appears to be that the rendering error is encountered loading up the grains and pillar before we get to execute the call_highstate which will sync_all, and error out due to pillar errors just be we call highstate, see lines https://github.com/saltstack/salt/blob/master/salt/modules/state.py#L1173-L1192 Problem is with class Minion and SProxyMinion too, after the classes have loaded the grains (which doesn't load the _grains custom grains), they then immediately compile the pillar which has a file making use of the custom grain from _grains, and then encounter the render error. SProxyMinion method gen_modules, even does a sync_all, but it is too late after the call to compile_pillar which shows the render error. Got a chicken and egg issue |
Have a problem found here , that is chicken and egg In the dunder init for class SMinion the opts["master_uri"] is not filled in till after the call to ioloop.run_sync, see https://github.com/saltstack/salt/blob/master/salt/minion.py#L928-L932 But with the |
Closing since associated PR is merged |
Is it possible this is around with current |
The problem will exist on 3007.1 and 3006.8, working on it but higher priority issues taking precedence, have the changes done, but need to write a lot more tests so don't have the problems that I did with the first attempt at fixing this which resulted in having to reverse the change. |
Description
state.apply fails and does not sync custom grains and modules scripts from /srv/salt/_grains and and /srv/salt/_modules directories if a pillar uses the custom grain or custom execution module.
Setup
Please be as specific as possible and give set-up details.
Steps to Reproduce the behavior
Setup directories and files; set minion to masterless; create a custom grain script and a pillar that uses custom grain returned from the script:
Run state.apply which results in an error
Expected behavior
The custom
_grains
and_modules
should be synced before rendering the pillars andstate.apply
should run successfully to completion.Screenshots
If applicable, add screenshots to help explain your problem.
Versions Report
salt --versions-report
Additional context
Running
salt-call --local saltutil.sync_all --pillar-root=/dev/null
before runningstate.apply
syncs the_grains
and_modules
correctly and allows thestate.apply
to run correctly.The text was updated successfully, but these errors were encountered: