correction to grains example

This commit is contained in:
Erik Johnson 2015-03-07 11:40:43 -07:00
parent 45dae70111
commit 0aa1029f24

View File

@ -139,9 +139,9 @@ can be used to simplify the :term:`top file`.
{% set node_type = salt['grains.get']('node_type', '') %}
{% if node_type %}
'node_type:{{ self }}':
'node_type:{{ node_type }}':
- match: grain
- {{ self }}
- {{ node_type }}
{% endif %}
Using Jinja templating, only one match entry needs to be defined.
@ -182,8 +182,8 @@ approach would be code something similar to the following:
# initialize a grains dictionary
grains = {}
# Some code for logic that sets grains like
grains['yourcustomgrain']=True
grains['anothergrain']='somevalue'
grains['yourcustomgrain'] = True
grains['anothergrain'] = 'somevalue'
return grains
Before adding a grain to Salt, consider what the grain is and remember that