Skip to content

Instantly share code, notes, and snippets.

@UtahCampusD
Created December 2, 2016 19:30
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 UtahCampusD/b43543c4a1eb2a781b2df01a5d39c2e4 to your computer and use it in GitHub Desktop.
Save UtahCampusD/b43543c4a1eb2a781b2df01a5d39c2e4 to your computer and use it in GitHub Desktop.
- Rendering SLS 'base:stats.syslog.syslog' failed: Jinja error: argument of type 'function' is not iterable
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/salt/utils/templates.py", line 368, in render_jinja_tmpl
output = template.render(**decoded_context)
File "/usr/lib/python2.7/site-packages/jinja2/environment.py", line 969, in render
return self.environment.handle_exception(exc_info, True)
File "/usr/lib/python2.7/site-packages/jinja2/environment.py", line 742, in handle_exception
reraise(exc_type, exc_value, tb)
File "<template>", line 38, in top-level template code
TypeError: argument of type 'function' is not iterable
; line 38
---
[...]
{% set master_dirs = salt['cp.list_master_dirs'] %}
# # Check if minion has custom directory
{% if custom_syslog_dir in master_dirs %} <======================
# Execute if directory exists
custom-syslog:
file.recurse:
- name: /etc/rsyslog.d
- user: root
[...]
---
# Custom configs
{% set host = grains['host'] %}
{% set custom_syslog_dir = 'stats/syslog/files/custom/'~host %}
{% set master_dirs = salt['cp.list_master_dirs'] %}
# # Check if minion has custom directory
{% if custom_syslog_dir in master_dirs %}
# Execute if directory exists
custom-syslog:
file.recurse:
- name: /etc/rsyslog.d
- user: root
- group: root
- dir_mode: 2775
- file_mode: 0644
- source: salt://stats/syslog/files/custom/{{host}}
- require:
- pkg: syslog-installed
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment