saltstack / salt

Software to automate the management and configuration of any infrastructure or application at scale. Get access to the Salt software package repository here:
https://repo.saltproject.io/
Apache License 2.0
14.17k stars 5.48k forks source link

New minions don't automatically refresh_pillar #5341

Closed hdonnay closed 11 years ago

hdonnay commented 11 years ago

The pillar sls:

{% set master = [ 'green-master', 'blue-master', 'black-master' ] -%}
{% set storage = [ 'green', 'blue', 'black' ] -%}
{% set roles = salt['grains.get']('role', []) -%}
iptables:

  spf_allow:
    - 22
{%- if 'database' in roles %}
    - 5432
{%- endif %}
{%- for role in master %}{% if role in roles %}
    # superpeer port
    - 4283
    # hazelcast port
    - 4286
{%- endif %}{% endfor %}

{%- if 'balancer' in roles %}
  wan_allow:
    - 80
    - 443
{%- endif %}

{%- for role in master %}{% if role in roles %}
  wan_allow:
    - 443
    - 4242
    - 80

  web_nat:
    - [ 80, 8080 ]
    - [ 443, 8443 ]

  wan_nat:
    - [ 443, 4242 ]
{%- endif %}{% endfor %}

{%- for role in storage %}{% if role in roles %}
  wan_allow:
    - 4282

  wan_nat:
    - [ 443, 4282 ]
{%- endif %}{% endfor %}

output:

Master:

root@mkb-msp:/srv/pillar# salt gam-msp\* pillar.raw key=iptables
gam-msp:
    ----------
root@mkb-msp:/srv/pillar# salt gam-msp\* pillar.raw key=_errors
gam-msp:
    - Rendering SLS iptables failed, render error:
    - Traceback (most recent call last):
    -   File "/usr/lib/pymodules/python2.7/salt/utils/templates.py", line 55, in render_tmpl
    -     output = render_str(tmplstr, context, tmplpath)
    -   File "/usr/lib/pymodules/python2.7/salt/utils/templates.py", line 98, in render_jinja_tmpl
    -     output = jinja_env.from_string(tmplstr).render(**context)
    -   File "/usr/lib/python2.7/dist-packages/jinja2/environment.py", line 894, in render
    -     return self.environment.handle_exception(exc_info, True)
    -   File "<template>", line 7, in top-level template code
    - TypeError: argument of type 'StrictUndefined' is not iterable
    - 

Minion:

root@gam-msp:~# salt-call pillar.raw key=iptables
[INFO    ] Configuration file path: /etc/salt/minion
spf_allow:
    - 22
    - 4283
    - 4286
wan_allow:
    - 443
    - 4242
    - 80
wan_nat:
    |_
      - 443
      - 4242
web_nat:
    |_
      - 80
      - 8080
    |_
      - 443
      - 8443
root@gam-msp:~# salt-call pillar.raw key=_errors 
[INFO    ] Configuration file path: /etc/salt/minion

This also only happens on some nodes, I can't seem to find a pattern as to why.

basepi commented 11 years ago

Have you tried salt '*' saltutil.refresh_pillar?

Still, odd. We'll get it looked at.

hdonnay commented 11 years ago

yeah, this seems to have fixed itself since my first post.

Any insight as to why still very much appreciated.

basepi commented 11 years ago

So you can no longer reproduce the problem?

hdonnay commented 11 years ago

Seems to happen on new nodes. After a saltutil.sync_all and a saltutil.refresh_pillar it seems to have gone away, but I didn't do any testing around this.

basepi commented 11 years ago

I've renamed the issue to better describe the issue. Thanks for the additional info.

thatch45 commented 11 years ago

This is the same issue as the other pillar bugs

basepi commented 11 years ago

@thatch45 Awesome. I'm not 100% sure I remember cherry-picking a pillar issue -- have we verified that it's in the 0.15 branch?

@hdonnay If you could test this again using the current develop branch, that would be helpful. =)

basepi commented 11 years ago

I'm closing this, as the fix is included in 0.15.3, announced later today.