summaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2012-08-24 11:13:05 -0400
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2012-08-24 11:13:05 -0400
commitd3548bd56110052f2d46ad664190a05391b5062b (patch)
tree76102a6215a599e88b0e17836f09e406695a56e3 /doc
parent3956133f14f9d832a665a7fb5f42d3f299d325d3 (diff)
downloadbcfg2-d3548bd56110052f2d46ad664190a05391b5062b.tar.gz
bcfg2-d3548bd56110052f2d46ad664190a05391b5062b.tar.bz2
bcfg2-d3548bd56110052f2d46ad664190a05391b5062b.zip
TemplateHelper: removed support for host- and group-specific helpers
Supporting these was basically impossible due to the way Python handles bytecode compilation. For instance, 'foo.py.G10_bar' would be compiled to foo.py.G10_barc, which is then indistinguishable from a helper for the group "barc" (or, rather, a _broken_ helper for that group, since a bytecode-compiled module cannot be imported successfully). There's no performance gain from specific helpers anyway -- they all get imported -- so I removed this functionality.
Diffstat (limited to 'doc')
-rw-r--r--doc/server/plugins/connectors/templatehelper.txt18
1 files changed, 8 insertions, 10 deletions
diff --git a/doc/server/plugins/connectors/templatehelper.txt b/doc/server/plugins/connectors/templatehelper.txt
index 24d7f18b5..374aeb171 100644
--- a/doc/server/plugins/connectors/templatehelper.txt
+++ b/doc/server/plugins/connectors/templatehelper.txt
@@ -23,9 +23,8 @@ will be read and added to matching client metadata objects. See
:ref:`writing-templatehelpers` below for more information on how to
write TemplateHelper scripts.
-TemplateHelper supports group- and host-specific helpers, so you could
-create, e.g., ``foo.py.G80_test`` to create a helper that only applied
-to machines in the group ``test``.
+TemplateHelper does not support group- or host-specific helpers. All
+helpers will be available to all clients.
.. _writing-templatehelpers:
@@ -34,15 +33,14 @@ Writing Helpers
A helper module is just a Python module with three special conditions:
-* The filename must end with ``.py`` (before any specificity
- strings, e.g., ``.G80_foo`` or ``.H_blah.example.com``
+* The filename must end with ``.py``
* The module must have an attribute, ``__export__``, that lists all of
the classes, functions, variables, or other symbols you wish to
export from the module.
-* ``data``, ``handle_event``, ``name``, and ``specific`` are reserved
- names. You should not include symbols with a reserved name in
- ``__export__``. Additionally, including symbols that start with an
- underscore or double underscore is bad form, and may also produce
+* ``data``, ``name``, ``fam``, ``Index``, and ``HandleEvent`` are
+ reserved names. You should not include symbols with a reserved name
+ in ``__export__``. Additionally, including symbols that start with
+ an underscore or double underscore is bad form, and may also produce
errors.
See ``examples/TemplateHelper`` for examples of helper modules.
@@ -60,7 +58,7 @@ a HelperModule object will has, as attributes, all symbols listed in
def hello(metadata):
return "Hello, %s!" % metadata.hostname
-To use this in a TGenshi template, we could do::
+To use this in a Genshi template, we could do::
${metadata.TemplateHelper['hello'].hello(metadata)}