On Thu, 2014-04-10 at 19:05 -0700, Stephen Wood wrote:
> Try:
>
>
> {% set service = grains['foo'] | default(None) %}
[...]
(in response to stuff)
[...]
> {% set service = salt['grains.get']('service_name', '') %}
[...]
Syntactically they appear to be expressing the same logic. Does the
former actually work?
The context that I've encountered this is having a general set of
defaults for a particular service /srv/base/pillar/nagios/client.sls,
for example, with /srv/base/pillar/nagios/clients containing individual
files where non-default pillar values are supplied.
I set up a reactor definition
set_pillar_host_files:
cmd.cmd.run:
- tgt: 'salt-master.*'
- arg:
- /srv/bin/pillar_update.sh {{ host }}
that triggers off of minion startup which does nothing more than touch a
file (named after the node) in each of several pillar directories such
that pillar compilation doesn't fail.
Is this running 40,0001 km west to get 1 km east? :)
-S
--
You know, I used to think it was awful that life was so unfair. Then I
thought, wouldn't it be much worse if life were fair, and all the
terrible things that happen to us come because we actually deserve them?
So, now I take great comfort in the general hostility and unfairness of
the universe.