Merge pull request #37028 from damon-atkins/update_topics_grains_doco

Update topics/grains doco, about considerations before adding a Grain
This commit is contained in:
Mike Place 2016-10-17 18:54:21 +09:00 committed by GitHub
commit 104a153a1f

View file

@ -132,6 +132,15 @@ Using Jinja templating, only one match entry needs to be defined.
Writing Grains
==============
Consider adding grains when the information is needed for targeting within
top.sls or salt cli. The grains should only contain the **bare minimum data**
required for targeting. The "name" and "data structure" of the grain should be
design to support many platforms, operating systems or applications. Most of the
time an "execution module" called from within Jinja template will provide the
necessary detail information for a Salt State. Consider if the idea for a grain
should be developed as a execution module rather than a grain or a combination
of both keeping minimum data within the grain.
The grains interface is derived by executing
all of the "public" functions found in the modules located in the grains
package or the custom grains directory. The functions in the modules of