summaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2011-08-18 12:06:54 -0400
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2011-08-18 12:06:54 -0400
commit81e936424b9f2a9ada20a83ca9353b5c0609b28c (patch)
treedddd0f57343eea8ccf5aa6108e79d709564a2743 /doc
parent8289840bf162f079de678abca5144f97bf491c13 (diff)
downloadbcfg2-81e936424b9f2a9ada20a83ca9353b5c0609b28c.tar.gz
bcfg2-81e936424b9f2a9ada20a83ca9353b5c0609b28c.tar.bz2
bcfg2-81e936424b9f2a9ada20a83ca9353b5c0609b28c.zip
added --altsrc flag to bcfg2-info buildfile
Diffstat (limited to 'doc')
-rw-r--r--doc/help/troubleshooting.txt3
-rw-r--r--doc/server/plugins/generators/tgenshi/index.txt23
2 files changed, 14 insertions, 12 deletions
diff --git a/doc/help/troubleshooting.txt b/doc/help/troubleshooting.txt
index b0eeca33e..7aeb0f247 100644
--- a/doc/help/troubleshooting.txt
+++ b/doc/help/troubleshooting.txt
@@ -70,7 +70,8 @@ operations
* clients - Current client metadata (profile and group) settings
* groups - Current group metadata values
* mappings - Configuration entries provided by plugins
-* buildfile <filename> <hostname> - Build a config file for a client
+* buildfile [--altsrc=<altsrc>] <filename> <hostname> - Build a config
+ file for a client
* buildbundle <bundle> <hostname> - Render a templated bundle for a client
* showentries <client> <type> - Build the abstract configuration (list
of entries) for a client
diff --git a/doc/server/plugins/generators/tgenshi/index.txt b/doc/server/plugins/generators/tgenshi/index.txt
index d7e0b3bf2..c5392dcc4 100644
--- a/doc/server/plugins/generators/tgenshi/index.txt
+++ b/doc/server/plugins/generators/tgenshi/index.txt
@@ -106,29 +106,31 @@ E.g.::
bcfg2-info buildfile /etc/foo.conf foo.example.com
+To generate a file with an altsrc attribute, you can run::
+
+ bcfg2-info buildfile /etc/foo/foo.conf --altsrc=/etc/foo.conf \
+ foo.example.com
+
Sometimes, it's useful to be able to do more in-depth troubleshooting
-by running the template manually. (This is also necessary if you want
-to generate a template that depends on an :ref:`altsrc
-<server-plugins-structures-altsrc>` tag.) To do this, run ``bcfg2-info
+by running the template manually. To do this, run ``bcfg2-info
debug``, and, once in the Python interpreter, run::
metadata = self.build_metadata("<hostname>")
path = "<relative path to template (see note below)>"
- bcfg2root = "<path to bcfg2 specification root>"
``path`` should be set to the path to the template file with a leading
slash, relative to the Bcfg2 specification root. See `Inside of
Templates`_ for examples.
-``bcfg2root`` should be set to the absolute path to the Bcfg2
-specification. (This is ``/var/lib/bcfg2`` by default.)
-
Then, run::
- import os
- name = os.path.dirname(path[path.find('/', 1):])
+ import os, Bcfg2.Options
from genshi.template import TemplateLoader, NewTextTemplate
- template = TemplateLoader().load(bcfg2root + path, cls=NewTextTemplate)
+ name = os.path.dirname(path[path.find('/', 1):])
+ setup = Bcfg2.Options.OptionParser({'repo':
+ Bcfg2.Options.SERVER_REPOSITORY})
+ setup.parse('--')
+ template = TemplateLoader().load(set['repo'] + path, cls=NewTextTemplate)
print template.generate(metadata=metadata, path=path, name=name).render()
This gives you more fine-grained control over how your template is
@@ -141,7 +143,6 @@ to the file to be generated, e.g.::
metadata = self.build_metadata("foo.example.com")
path = "/Cfg/etc/sysconfig/network-scripts/ifcfg-template/ifcfg-template.genshi"
- bcfg2root = "/var/lib/bcfg2"
name = "/etc/sysconfig/network-scripts/ifcfg-bond0"
File permissions