saltstack-formulas / salt-formula

Yes, Salt can Salt itself!
http://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html
Other
197 stars 423 forks source link

fix: revert to using `is mapping` in Jinja2 #497

Closed dafyddj closed 3 years ago

dafyddj commented 3 years ago

PR progress checklist (to be filled in by reviewers)


What type of PR is this?

Primary type

Secondary type

Does this PR introduce a BREAKING CHANGE?

No.

Related issues and/or pull requests

Describe the changes you're proposing

Pillar / config required to test the proposed changes

salt:
  master:
    ext_pillar:
      - cmd_yaml: cat /etc/salt/yaml
      - git:
          - develop https://gitserver/git-pillar.git:
              - env: base
      - reclass:
          inventory_base_uri: /etc/reclass

Debug log showing how the proposed changes work

Unable to manage file: Jinja syntax error: access to attribute '__class__' of 'list' object is unsafe.; line 1206

              ---
              [...]
              {%- for pillar in cfg_master['ext_pillar'] -%}
                {%- for key in pillar -%}
                  {%- if pillar[key] is string %}
                - {{ key }}: {{ pillar[key] }}
                  {#- Workaround for missing `is mapping` on CentOS 6, see #193: #}
                  {%- elif pillar[key] is iterable and 'dict' not in pillar[key].__class__.__name__ %}    <======================
                - {{ key }}:
                    {%- for parameter in pillar[key] %}
                      {%- if parameter is iterable and parameter is not string %}
                      {%- for param, children in parameter.items() %}
                  - {{ param }}:
              [...]
              ---

Documentation checklist

Testing checklist

Additional context

myii commented 3 years ago

Merged, thanks for the quick fix, @dafyddj.

saltstack-formulas-travis commented 3 years ago

:tada: This PR is included in version 1.7.5 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: