-
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
Custom grains are synced but not run #34303
Comments
@elsmorian I am not able to replicate this with the following test case on 2016.3.1: My grains file is here
Here is my master configuration file:
*Note: I also tried this with
|
Thanks for your reply @Ch3LL your suggestions did narrow my problem down! It looks like this and issue with my custom grain that sets grains based on other existing grains by accessing When I was writing the grain before it was unclear which variables you have access to in the context that custom grains are run, and I'm pretty sure the solution to use Included is the custom grain, its designed so I can use
The provider grain is set at machine build time and stored in /etc/salt/grains. Is it poor form to use something like below within a custom grain?
|
OK, well, I have answered my own question - doing the above is indeed poor form, as it causes an infinite loop!! Is there a way for custom grains to access the static grains set on the minion in the minion config file, or am I going about this all the wrong way? |
Wow, yeah ok, turns out if you try and do the above, and access the grain system from within a custom grain, you get a loop which stops all salt commands working- even the ones that invalidate the cache - I had to manually |
I have created a custom grain which declares |
I am seeing something pretty similar to this on 2017.7.2 - A sync_grains or a sync_all fixes the issue, but that seems like an unnecessary step to ensure our custom grains stay in place when we have not changed this particular custom grain in nearly 2 years. We had erroneously assumed this was due to a version issue; but we recently migrated all minions to 2017.7.2 and the issue remains. |
ping @DmitryKuzmenko do you know if this is suppose to be possible to use |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue. |
Description of Issue/Question
I'm having an odd problem which I believe started in 2016.3.1 but not sure.
I have a custom grain written, which runs fine on existing minions (2015.8.8.2), but do not on new ones(2016.3.1) - the extra grain keys and values show up in the older minion's grains, but not the new ones.
Running
salt-call -l debug saltutil.sync_grains
shows the file the grain is written and getting copied from the minion cache:[INFO ] Copying '/var/cache/salt/minion/files/base/_grains/network_helpers.py' to '/var/cache/salt/minion/extmods/grains/network_helpers.py'
Running the grain in iPython on both minions works fine.
Setup
2016.3.1 master,
2015.8.8.2 slave that runs custom grains fine
2016.3.1 slave that does not run custom grains
_grains
directory is in the root of thegitfs_root
on the master, usinggitpython
as the gitfs providerSteps to Reproduce Issue
Try and access grain value from a custom grain backed by gitfs.
Versions Report
Master:
Minion that can access custom grains:
Minion that can't access custom grain:
The text was updated successfully, but these errors were encountered: