Added placeholder docs for modules/returners/grains/renderers/states

This commit is contained in:
Seth House 2011-05-23 01:17:30 -06:00
parent 8f5a98ad30
commit 935a09e158
9 changed files with 301 additions and 1 deletions

View File

@ -57,7 +57,7 @@ Writing your own customizations on top of Salt
ref/index
ref/python-api
ref/modules/index
ref/returners
ref/returners/index
ref/grains
ref/renderers
ref/states

5
doc/ref/grains.rst Normal file
View File

@ -0,0 +1,5 @@
======
Grains
======
Static information that Salt derives about the system it's running on.

3
doc/ref/index.rst Normal file
View File

@ -0,0 +1,3 @@
==============================
Introduction to extending Salt
==============================

128
doc/ref/modules/index.rst Normal file
View File

@ -0,0 +1,128 @@
=======
Modules
=======
Salt modules are the functions called by the :command:`salt` command.
Full list of builtin modules
============================
.. toctree::
:maxdepth: 1
:glob:
*
Easy Modules to write
=====================
Salt modules are amazingly simple to write, just write a regular Python module
or a regular Cython module and place it in the ``salt/modules`` directory.
Since Salt modules are just Python/Cython modules there are no restraints as to
what you can put inside of a salt module, and if a Salt module has errors and
cannot import the Salt minion will continue to load without issue, the module
with errors will simply be omitted.
If adding a Cython module the file must be named ``<modulename>.pyx`` so that
the loader knows that the module needs to be imported as a Cython module. The
compilation of the Cython module is automatic and happens when the minion
starts, so only the ``*.pyx`` file is required.
Preloaded Modules Data
======================
When interacting with modules often it is nice to be able to read information
dynamically about the minion, or load in configuration parameters for a module.
Salt allows for different types of data to be loaded into the modules by the
minion, as of this writing Salt loads information gathered from the Salt Grains
system and from the minion configuration file.
Grains Data
-----------
The Salt minion detects information about the system when started. This allows
for modules to be written dynamically with respect to the underlying hardware
and OS. This information is referred to as Salt Grains, or "grains of salt".
The Grains system was introduced to replace Facter, since relying on a Ruby
application from a Python application was both slow and inefficient. Grains
support replaces Facter in all releases after 0.8
The values detected by the Salt Grains on the minion are available in a dict by
the name of ``__grains__`` and can be accessed from within callable objects in
the Python modules.
To see the contents of the grains dict for a given system in your deployment
run the :func:`grains.items` function:
.. code-block:: bash
salt 'hostname' grains.items
To use the ``__grains__`` dict simply call it as a Python dict from within your
code, an excellent example is available in the Grains module:
:mod:`salt.modules.grains`.
Module Configuration
--------------------
Since parameters for configuring a module may be desired, Salt allows for
configuration information stored in the main minion config file to be passed to
the modules.
Since the minion configuration file is a yaml document, arbitrary configuration
data can be passed in the minion config that is read by the modules. It is
**strongly** recommended that the values passed in the configuration file match
the module. This means that a value intended for the ``test`` module should be
named ``test.<value>``.
Configuration also requires that default configuration parameters need to be
loaded as well. This can be done simply by adding the ``__opts__`` dict to the
top level of the module.
The test module contains usage of the module configuration, and the default
configuration file for the minion contains the information and format used to
pass data to the modules. :mod:`salt.modules.test`, :file:`conf/minion`.
Documentation
=============
Salt modules are self documenting, the :func:`sys.doc` function will return the
documentation for all available Facter modules:
.. code-block:: bash
salt '*' sys.doc
This function simple prints out the docstrings found in the modules, when
writing salt modules, please follow the formating conventions for docstrings as
they appear in the other modules.
How Functions are Read
======================
In Salt Python callable objects contained within a module are made available to
the Salt minion for use. The only exception to this rule is a callable object
with a name starting with an underscore ``_``.
Objects Loaded Into the Salt Minion
-----------------------------------
.. code-block:: python
def foo(bar):
return bar
class baz:
def __init__(self, quo):
return quo
Objects NOT Loaded into the Salt Minion
---------------------------------------
.. code-block:: python
def _foobar(baz): # Preceded with an _
return baz
cheese = {} # Not a callable python object

125
doc/ref/modules/modules.rst Normal file
View File

@ -0,0 +1,125 @@
=============================
:mod:`salt.modules.butterkvm`
=============================
.. automodule:: salt.modules.butterkvm
:members:
===========================
:mod:`salt.modules.cluster`
===========================
.. automodule:: salt.modules.cluster
:members:
=======================
:mod:`salt.modules.cmd`
=======================
.. automodule:: salt.modules.cmd
:members:
========================
:mod:`salt.modules.cmdc`
========================
.. automodule:: salt.modules.cmdc
:members:
======================
:mod:`salt.modules.cp`
======================
.. automodule:: salt.modules.cp
:members:
===========================
:mod:`salt.modules.cytestx`
===========================
.. automodule:: salt.modules.cytestx
:members:
========================
:mod:`salt.modules.disk`
========================
.. automodule:: salt.modules.disk
:members:
==========================
:mod:`salt.modules.grains`
==========================
.. automodule:: salt.modules.grains
:members:
===========================
:mod:`salt.modules.network`
===========================
.. automodule:: salt.modules.network
:members:
==========================
:mod:`salt.modules.pacman`
==========================
.. automodule:: salt.modules.pacman
:members:
===========================
:mod:`salt.modules.service`
===========================
.. automodule:: salt.modules.service
:members:
=========================
:mod:`salt.modules.state`
=========================
.. automodule:: salt.modules.state
:members:
==========================
:mod:`salt.modules.status`
==========================
.. automodule:: salt.modules.status
:members:
===========================
:mod:`salt.modules.statusc`
===========================
.. automodule:: salt.modules.statusc
:members:
==========================
:mod:`salt.modules.sysctl`
==========================
.. automodule:: salt.modules.sysctl
:members:
========================
:mod:`salt.modules.test`
========================
.. automodule:: salt.modules.test
:members:
========================
:mod:`salt.modules.virt`
========================
.. automodule:: salt.modules.virt
:members:
=======================
:mod:`salt.modules.yum`
=======================
.. automodule:: salt.modules.yum
:members:

5
doc/ref/renderers.rst Normal file
View File

@ -0,0 +1,5 @@
=========
Renderers
=========
A python module that impments a render() method.

View File

@ -0,0 +1,15 @@
=========
Returners
=========
Salt returners allow the return data to be sent to arbitrary locations instead
of the salt master.
Full list of builtin returners
==============================
.. toctree::
:maxdepth: 1
:glob:
*

View File

@ -0,0 +1,13 @@
===========================
:mod:`salt.returners.local`
===========================
.. automodule:: salt.returners.local
:members:
===========================
:mod:`salt.returners.redis`
===========================
.. automodule:: salt.returners.redis
:members:

6
doc/ref/states.rst Normal file
View File

@ -0,0 +1,6 @@
=================
State enforcement
=================
Enforce that specified packages are installed or that specified services are
running.