On 23/10/2013 20:51 , Colton Myers wrote:
> An easy way for grains is to use the salt `grains.get` function. It
> allows you to fetch a grain if it's there, or provide a default if it's
> not. So something like `{{ salt['grains.get']('mygrain', None) }}`
> would return the contents of the grain if it existed, or None if it
> didn't. You could then use a conditional to check for the None value.
Or do
{{ grains['mygrain'] | default (None) }}
or
{{ grains.mygrain | default (None) }}
as long as you're inside jinja.
The latter one will confuse you if you go back to python or use mako :)
M.