2015.5.3 Pillar include under nested key is broken
Problem is here https://github.com/saltstack/salt/blob/2015.5/salt/pillar/init.py#L418 Variable v is getting value of None.
pillar:
include:
- narwhal:
key: narwhal
error:
2015-09-01 10:45:36,531 [salt.loaded.int.render.yaml][DEBUG ][32707] Results of YAML rendering:
OrderedDict([('include', [OrderedDict([('narwhal', None), ('key', 'narwhal')])])])
2015-09-01 10:45:36,532 [salt.master ][ERROR ][32707] Error in function _pillar:
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/salt/master.py", line 1457, in run_func
ret = getattr(self, func)(load)
File "/usr/lib/python2.7/site-packages/salt/master.py", line 1220, in _pillar
data = pillar.compile_pillar(pillar_dirs=pillar_dirs)
File "/usr/lib/python2.7/site-packages/salt/pillar/__init__.py", line 579, in compile_pillar
pillar, errors = self.render_pillar(matches)
File "/usr/lib/python2.7/site-packages/salt/pillar/__init__.py", line 452, in render_pillar
pstate, mods, err = self.render_pstate(sls, saltenv, mods)
File "/usr/lib/python2.7/site-packages/salt/pillar/__init__.py", line 415, in render_pstate
defaults = v.get('defaults', {})
AttributeError: 'NoneType' object has no attribute 'get'
@deuscapturus, thanks for the report.
Did this ever work? I don't know that this is a bug, this looks like bad syntax in the pillar sls file
Yes, this did work in the past. It's been in the documentation for a long time as well. https://docs.saltstack.com/en/latest/topics/pillar/#including-other-pillars
This feature solves a lot of big problems for us. Example: Making pillar data available to a Jenkins server to get application settings for a build process without colliding with other pillars or duplicating the pillars.
I'm hitting this issue as well if I use the import key like shown in the example that @deuscapturus posted up top.
[edit: remove my previous guess at what was wrong, since after testing I was wrong]
Here is my traceback using 2015.5.5 on CentOS 7
2015-10-08 12:10:26,031 [salt.master ][ERROR ][2274] Error in function _pillar:
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/salt/master.py", line 1460, in run_func
ret = getattr(self, func)(load)
File "/usr/lib/python2.7/site-packages/salt/master.py", line 1223, in _pillar
data = pillar.compile_pillar(pillar_dirs=pillar_dirs)
File "/usr/lib/python2.7/site-packages/salt/pillar/__init__.py", line 583, in compile_pillar
pillar, errors = self.render_pillar(matches)
File "/usr/lib/python2.7/site-packages/salt/pillar/__init__.py", line 456, in render_pillar
pstate, mods, err = self.render_pstate(sls, saltenv, mods)
File "/usr/lib/python2.7/site-packages/salt/pillar/__init__.py", line 419, in render_pstate
defaults = v.get('defaults', {})
AttributeError: 'NoneType' object has no attribute 'get'
Isn't this an indentation problem in the pillar file? Can you try it like follows?
include:
- narwhal:
key: narwhal
With the exact example posted in the original post, the same error happens on < 2015.5.5
@frots, good catch! It looks like that does resolve the issue for my usage at least.