Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hack to make rendering work on CentOS 6 #298

Merged
merged 2 commits into from
Mar 4, 2017

Conversation

0xf10e
Copy link
Contributor

@0xf10e 0xf10e commented Feb 24, 2017

!! Not tested with an actual !!
!! configured ext_pillar yet !!

 !!   Not tested with an actual   !!
 !!  configured `ext_pillar` yet  !!

- jinja on RHEL/CentOS 6 has no 'mapping'
  test (see salt-formula issue saltstack-formulas#193)
- {% do ... %} allows no assignment, only
  function calls
- of course, `type(foo) is dict` doesn't
  work because it's no jinja test
- maybe `.isinstance()` would be nicer/more
  reliable
@0xf10e
Copy link
Contributor Author

0xf10e commented Feb 24, 2017

Looks like this patch isn't enough to fix #193:

/srv/salt/pillar.git:1711% sudo salt centos6minion state.sls salt.master
centos6minion:
    Data failed to compile:
----------
    Rendering SLS 'base:salt.master' failed: Jinja syntax error: no test named 'mapping'
/var/cache/salt/minion/files/base/salt/map.jinja(8):
---
[...]

{%- macro deep_merge(a, b) %}
{%-     for k,v in b.iteritems() %}
{%-         if v is string or v is number %}
{%-             do a.update({ k: v }) %}
{%-         elif v is not mapping %}    <======================
{%-             if a[k] is not defined %}
{%-                 do a.update({ k: v }) %}
{%-             elif a[k] is iterable and a[k] is not mapping and a[k] is not string %}
{%-                 do a.update({ k: v|list + a[k]|list}) %}
{%-             else %}
[...]
---
ERROR: Minions returned with non-zero exit code

😒

Checks for 'dict' in `x.__class__.__name__` b/c
neither `type()` nor `isinstance()` is available.
@0xf10e
Copy link
Contributor Author

0xf10e commented Feb 24, 2017

@blast-hardcheese @mchugh19 @gravyboat
I only tested with an almost empty pillar[salt]* but e86e6fc makes the states salt.master and salt.minion render and run on CentOS 6 .

*)

/srv/salt/formulas/salt-formula.git:1818% sudo salt centos6minion pillar.items
centos6minion:
    ----------
    salt:
        ----------
        minion:
            ----------
            master:
                192.168.178.20

@gravyboat
Copy link
Contributor

Definitely hacky but it looks okay to me. I can't merge any more so someone else will have to do it.

@0xf10e
Copy link
Contributor Author

0xf10e commented Mar 4, 2017

I don't want to merge my own PR, maybe @ek9 , @aboe76 or @iggy?

@puneetk puneetk merged commit 31229c5 into saltstack-formulas:master Mar 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants