Open giorgiozeeman opened 6 years ago
I've faced with the same problem and the official answer is that pillar.get
is a pure dict pillar
method get
, which has no idea of the nested hierarchy and complex keys. Contrary to that salt['pillar.get']
module function has knowledge about the nested keys and should work in such situation.
The only problem is that in the Stack config file salt
is undefined and __salt__['pillar.get']('ssl_certs:cert_names', [])
doesn't return given certificate names either....
This is not documented yet, but you can use the __stack__['traverse']
function as described in a previous comment: https://github.com/bbinet/pillarstack/issues/13#issuecomment-223214506
If this works for you, feel free to submit a pull request to add this feature to the readme.
Haven't been able to get nested keys directly working either but this seems to works for me:
{%- set node = pillar.get('node') %}
regions/{{ node.region }}.yml
where node
is defined in a stack config loaded before the one containing the above example.
Hello,
we are successfully using PillarStack with GitStack-Pillar.
However, we noticed that the pillar.get function in the PillarStack configuration file (stack.cfg), seems unable to retrieve nested items and it falls back to the default value.
We would like to use this function to be able to set a default value in case the nested variable is not defined.
The nested value actually exists in the pillar dictionary.
The pillar function works...
However the pillar.get function is unable to get the nested item and it always falls back to the default star_acme_net.
This is an excerpt of our /etc/salt/master
This is the output of salt --versions
Thanks!