bbinet / pillarstack

Custom saltstack ext_pillar heavily based on jinja2 for maximum flexibility
MIT License
59 stars 15 forks source link

My merging strategies don't work #14

Closed mjinks closed 7 years ago

mjinks commented 8 years ago

I need to merge two data sources into a single pillar, which is what brings me to PillarStack. But I'm misunderstanding something.

If I have, in a .yml file, call it '/srv/exe-pillar/first.yml', something like:

users:
  user-foo:
    home: /home/foo
  user-bar:
    home: /home/bar

...alongside another one, say, '/srv/exe-pillar/second.yml':

users:
  user-foo:
    shell: /bin/bash
  user-bar:
    shell: /bin/false

...listed in '/srv/ext_pillar/stack.cfg' as:

stack/first.yml
stack/second.yml

That works fine. But if I augment one of the pillar files with a merge strategy, like:

users:
  _: merge_last
  user-foo:
    home: /home/foo
 [...]

...the result fails to compile, with Jinja errors, for example:

----------
    Rendering SLS 'base:users' failed: Jinja variable 'str object' has no attribute 'get'
----------

So I guess I'm misunderstanding something that should be obvious? I need to be able to guarantee that my sub-pillars render in a specified order; is there a different way I should be coming at this?

Thanks.

bbinet commented 8 years ago

You should not get a Jinja rendering failure here. Are you doing some other Jinja related stuff in you base:users SLS? Also could you send me a full example of a failing setup so that I can investigate further?

Although it will not cause a Jinja rendering failure, you made a typo in your last excerpt: you should have written __: merge-last

bbinet commented 7 years ago

I'll close this issue which is not active: please reopen if needed.