"Got unknown grain from master: roles" when grains are in minion.d files
When we put our roles into a conf file in the minion.d directory we get an error message when applying highstate:
[#14]: salt-call state.highstate
[INFO ] Loaded configuration file: /etc/salt/minion
[INFO ] Loading fresh modules for state activity
[ERROR ] Got unknown grain from master: roles
[ERROR ] Got unknown grain from master: roles
[INFO ] Loading fresh modules for state activity
...
The interesting thing is that this doesn't seem to actually affect anything and the proper states are applied.
If we move the grains into the main minion config then the error goes away.
does the grain show up on the minion with salt-call -g ?
Yes they do.
well, it is worth a look :)
I can replicate this (for salt-minion-0.10.2-2.el6.noarch) , so looks like a bug to me as well. i.e when I put a grain: entry in /etc/salt/minion.d/grains.conf like
grains: type: test1 location: outside
and try to use it in top.sls file and 'salt '*' state.highstate' . I get an error
[ERROR ] Got unknown grain from master: type
I move same grains: entry in /etc/salt/minion (main conf file) and error goes away.
I will try to replicate this with the latest code and get it fixed, thanks!
I think it is little convenience bug :). On minions, If I uncomment a 'default_include' line in /etc/salt/minion, then it works for salt.highstate, else it is ignored.
(1) Workaround for current version of salt (0.10.3)
#default_include: minion.d/*.conf <==uncomment this line.
But I suggest to better fix a code. Here is a little patch for 'salt/loader.py' file. (2) Lazy patch :).
@@ -132,7 +132,9 @@
salt.config.load_config(
pre_opts, opts['conf_file'], 'SALT_MINION_CONFIG'
)
- default_include = pre_opts.get('default_include', [])
+ #default_include = pre_opts.get('default_include', [])
+ default_include = pre_opts.get('default_include', 'minion.d/*.conf')
+
include = pre_opts.get('include', [])
pre_opts = salt.config.include_config(
default_include, pre_opts, opts['conf_file'], verbose=False
(3) Better patch: As 'default_include' variable is already predefined in 'config.py' file, that is parsed earlier, so there is no point in redefining that again in 'loader.py' so a better version of patch for 'loader.py' file may be
@@ -132,7 +132,15 @@
salt.config.load_config(
pre_opts, opts['conf_file'], 'SALT_MINION_CONFIG'
)
- default_include = pre_opts.get('default_include', [])
+ #default_include = pre_opts.get('default_include', [])
+ #-- if 'default_include' is missing(or commented out) in minion
+ #-- config file then look for predefined default_config
+ if 'default_include' in opts:
+ predef_default_include = opts['default_include']
+ else:
+ predef_default_include = []
+ default_include = pre_opts.get('default_include', predef_default_include)
+
include = pre_opts.get('include', [])
pre_opts = salt.config.include_config(
default_include, pre_opts, opts['conf_file'], verbose=False
hope this helps.
Yes, this looks good. I will most likely get to this in a few more days when I finish up the major features for 0.10.4
Nice job @UtahDave ! This is a very clean fix :)
Nice and clean indeed! Thanks @UtahDave.