diff options
author | Alexander Sulfrian <alexander.sulfrian@fu-berlin.de> | 2015-07-22 18:39:32 +0200 |
---|---|---|
committer | Alexander Sulfrian <alexander.sulfrian@fu-berlin.de> | 2015-08-26 19:12:30 +0200 |
commit | 6851a2931869aa9d9181b7b2d95f048aa5415a23 (patch) | |
tree | 5d56dbf8ecc48ff6a9f1970d91445366e34534f0 /doc | |
parent | c7e67299381df961ff8274e9b53827c2bddbb47b (diff) | |
download | bcfg2-6851a2931869aa9d9181b7b2d95f048aa5415a23.tar.gz bcfg2-6851a2931869aa9d9181b7b2d95f048aa5415a23.tar.bz2 bcfg2-6851a2931869aa9d9181b7b2d95f048aa5415a23.zip |
Rules: New options replace_name to replace %{name} in attributes
If you use the regex feature of Rules/Defaults you may need the real name
of the matched entry in an attribute (for example home of POSIXUser).
You can now enable replace_name for rules or defaults and %{name} will be
replaces in the attribues of the Element before adding them to the target
entry.
This allows you to write something like that in Defaults to assing a default
home directory somewhere else to all users with unset home:
<POSIXUser name='.*' home='/somewhere/%{name}'/>
Diffstat (limited to 'doc')
-rw-r--r-- | doc/releases/1.4.0pre2.txt | 1 | ||||
-rw-r--r-- | doc/server/plugins/generators/rules.txt | 20 | ||||
-rw-r--r-- | doc/server/plugins/structures/defaults.txt | 7 |
3 files changed, 28 insertions, 0 deletions
diff --git a/doc/releases/1.4.0pre2.txt b/doc/releases/1.4.0pre2.txt index a5c10777a..9ad64db4e 100644 --- a/doc/releases/1.4.0pre2.txt +++ b/doc/releases/1.4.0pre2.txt @@ -19,6 +19,7 @@ environments. * NagiosGen: Add bundles to configuration * HomeBrew: Initial add of plugin +* Rules/Defaults: Add possibility to use name of entry in attributes backwards-incompatible user-facing changes ------------------------------------------ diff --git a/doc/server/plugins/generators/rules.txt b/doc/server/plugins/generators/rules.txt index e4f47c2bf..7aeec6990 100644 --- a/doc/server/plugins/generators/rules.txt +++ b/doc/server/plugins/generators/rules.txt @@ -512,3 +512,23 @@ you'd have to explicitly specify ``<Service name="bcfg2.*".../>``. Note that only one Rule can apply to any abstract entry, so you cannot specify multiple regexes to match the same rule. + +Replacing the name of the Entry in Attributes +============================================= + +If you are using regular expressions to match the abstract configuration +entries, you may need the concrete name of the entry in some attributes. +To use this feature, you have to enable it. It is only useful, if used +together with regex matching. :: + + [rules] + regex = yes + replace_name = yes + +You now can write something like that in your xml file: + +.. code-block:: xml + + <POSIXUser name='.*' home='/somewhere/%{name}'/> + +``%{name}`` will be correctly replaced with the username for each POSIXUser. diff --git a/doc/server/plugins/structures/defaults.txt b/doc/server/plugins/structures/defaults.txt index 58b9feddb..9d37b8e64 100644 --- a/doc/server/plugins/structures/defaults.txt +++ b/doc/server/plugins/structures/defaults.txt @@ -29,3 +29,10 @@ on Fedora 15 and the ``chkconfig`` tool on Fedora 14, you could do:: If you were to specify a ``type`` attribute for a Service entry in Rules (or a ``type`` attribute for a BoundService entry in Bundler), that would take precendence over the default. + +Like :ref:`server-plugins-generators-rules`, Defaults can also replace +``%{name}`` in attributes with the real name of the entry. To enable this, +add the following setting to ``bcfg2.conf``:: + + [defaults] + replace_name = yes |