hostsfile:
alias:
main_ip
hosts:
None
only:
----------
127.0.0.1:
- foo.tld
- foo
- localhost
Rendering SLS 'hostsfile' failed: Jinja error: 'NoneType' object is not iterable
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/salt/utils/templates.py", line 392, in render_jinja_tmpl
output = template.render(**decoded_context)
File "/usr/lib/python3/dist-packages/jinja2/environment.py", line 1008, in render
return self.environment.handle_exception(exc_info, True)
File "/usr/lib/python3/dist-packages/jinja2/environment.py", line 780, in handle_exception
reraise(exc_type, exc_value, tb)
File "/usr/lib/python3/dist-packages/jinja2/_compat.py", line 37, in reraise
raise value.with_traceback(tb)
File "<template>", line 22, in top-level template code
TypeError: 'NoneType' object is not iterable
; line 22
---
[...]
{%- set pillar_only = salt['pillar.get']('hostsfile:only', {}) %}
{%- set mine_hosts = salt['mine.get'](minions, minealias, tgt_type=minions_type) %}
{%- if mine_hosts is defined %}
{%- do hosts.update(mine_hosts) %}
{%- endif %}
{%- do hosts.update(pillar_hosts) %} <======================
I think this formula could be used to generate a /etc/hosts only using a mine query but no static host.
Working on it, hoping to find a bugfix soon.