From d61a93fde5623372deb44dcf49d9ffd1773a454f Mon Sep 17 00:00:00 2001 From: Colton Myers Date: Wed, 18 Dec 2013 11:13:21 -0700 Subject: [PATCH] Document availability of templating variables, Fix #9261 --- doc/ref/states/vars.rst | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/doc/ref/states/vars.rst b/doc/ref/states/vars.rst index 1fcb8901c0..bf916050ea 100644 --- a/doc/ref/states/vars.rst +++ b/doc/ref/states/vars.rst @@ -4,14 +4,16 @@ SLS Template Variable Reference The template engines available to sls files and file templates come loaded with a number of context variables. These variables contain information and -functions to assist in the generation of templates. +functions to assist in the generation of templates. See each variable below +for its availability -- not all variables are available in all templating +contexts. Salt ==== The `salt` variable is available to abstract the salt library functions. This variable is a python dictionary containing all of the functions available to -the running salt minion: +the running salt minion. It is available in all salt templates. .. code-block:: jinja @@ -24,7 +26,8 @@ Opts ==== The `opts` variable abstracts the contents of the minion's configuration file -directly to the template. The `opts` variable is a dictionary. +directly to the template. The `opts` variable is a dictionary. It is available +in all templates. .. code-block:: jinja @@ -35,7 +38,8 @@ The ``config.get`` function also searches for values in the `opts` dictionary. Pillar ====== -The `pillar` dictionary can be referenced directly: +The `pillar` dictionary can be referenced directly, and is available in all +templates: .. code-block:: jinja @@ -53,7 +57,8 @@ is not available in pillar and dictionaries can be traversed directly: Grains ====== -The `grains` dictionary makes the minion's grains directly available: +The `grains` dictionary makes the minion's grains directly available, and is +available in all templates: .. code-block:: jinja @@ -69,8 +74,8 @@ defaults: env ==== -The `env` variable is available in sls files when gathering the sls from -an environment. +The `env` variable is available in only in sls files when gathering the sls +from an environment. .. code-block:: jinja @@ -79,8 +84,10 @@ an environment. sls ==== -The `sls` variable contains the sls reference value. The sls reference value -is the value used to include the sls in top files or via the include option. +The `sls` variable contains the sls reference value, and is only available in +the actual SLS file (not in any files referenced in that SLS). The sls +reference value is the value used to include the sls in top files or via the +include option. .. code-block:: jinja