Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@omega
Created August 23, 2015 14:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save omega/98390a70a18b9184ffb4 to your computer and use it in GitHub Desktop.
Save omega/98390a70a18b9184ffb4 to your computer and use it in GitHub Desktop.
root@salt:~# salt 'web01*' state.highstate
web01:
Data failed to compile:
----------
Rendering SLS 'base:web/nginx' failed: Jinja error: 'NoneType' object is not iterable
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/salt/utils/templates.py", line 306, in render_jinja_tmpl
output = template.render(**decoded_context)
File "/usr/lib/python2.7/dist-packages/jinja2/environment.py", line 969, in render
return self.environment.handle_exception(exc_info, True)
File "/usr/lib/python2.7/dist-packages/jinja2/environment.py", line 742, in handle_exception
reraise(exc_type, exc_value, tb)
File "<template>", line 7, in top-level template code
TypeError: 'NoneType' object is not iterable
; line 7
---
[...]
pkg.installed: []
service.running:
- require:
- pkg: nginx
- watch:
{% for hostname, data in pillar.get('web:sites') %} <======================
- file: /etc/nginx/sites-enabled/{{hostname}}
{% endfor %}
{% for hostname, data in pillar.get('web:sites') %}
/etc/nginx/sites-enabled/{{hostname}}:
file.managed:
[...]
---
root@salt:~# salt '*' pillar.get web:sites
mongo01:
web01:
----------
some.host.com:
----------
location:
http://localhost:3000
ssl:
True
websockets:
True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment