summaryrefslogtreecommitdiffstats
path: root/src/lib/Server/Plugins
diff options
context:
space:
mode:
authorMike McCallister <mike@mccllstr.com>2011-07-26 09:34:39 -0500
committerMike McCallister <mike@mccllstr.com>2011-07-26 09:34:39 -0500
commitbda0f01adda437a6bac1c5a890063bccbd1f5b78 (patch)
treead70c669b197be10a117dcf11921194b9864a2be /src/lib/Server/Plugins
parent17d801958e683c5ff4a9122f9fd172f0be67f5a5 (diff)
downloadbcfg2-bda0f01adda437a6bac1c5a890063bccbd1f5b78.tar.gz
bcfg2-bda0f01adda437a6bac1c5a890063bccbd1f5b78.tar.bz2
bcfg2-bda0f01adda437a6bac1c5a890063bccbd1f5b78.zip
Rewrote DirectoryBacked so it handles files contained in an arbitrary directory layout.
Previously, DirectoryBacked (and as a result Bundler, Deps, Rules, Base, Pkgmgr, and others) only recognized XML files contained in the top-level plugin directory, for example: Deps/foo.xml Deps/subdir/foo.xml # <--- Ignored Bundler/bar.xml Bundler/subdir/baz.xml # <--- Ignored Now it can support the following as well: Deps/debian-lenny/foo.xml Deps/debian-squeeze/foo.xml Bundler/group-a/bar.xml Bundler/group-b/baz.xml Note that the directories and filenames do not factor into the semantic meaning of the configuration specification. The contents of foo.xml must stand alone, as if they were in the same single-level directory as before. In the case of Deps, Rules, Pkgmgr, and Svcmgr, you must use Groups and priorities within the XML files as needed to ensure that Bcfg2 can correctly resolve the configuration for your hosts. For example, prior to this change you would use a single file like the following: Deps/foo.xml: <Dependencies priority="0"> <Group name="debian-lenny"> <Package name="foo"> <Path name="/etc/foo.conf"/> </Package> </Group> <Group name="debian-squeeze"> <Package name="foo"> <Path name="/etc/foo.conf"/> <Path name="/etc/bar.conf"/> </Package> </Group> </Dependencies> Now you can use a pair of files in separate directories like the following. Note how the groups within each file prevent there from being two sources for a single package: Deps/debian-lenny/foo.xml: <Dependencies priority="0"> <Group name="debian-lenny"> <Package name="foo"> <Path name="/etc/foo.conf"/> </Package> </Group> </Dependencies> Deps/debian-squeeze/foo.xml: <Dependencies priority="0"> <Group name="debian-squeeze"> <Package name="foo"> <Path name="/etc/foo.conf"/> <Path name="/etc/bar.conf"/> </Package> </Group> </Dependencies> In the case of Bundler, individual filenames must remain unique throughout the directory hierarchy, and they must match the bundle name.
Diffstat (limited to 'src/lib/Server/Plugins')
-rw-r--r--src/lib/Server/Plugins/Bundler.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lib/Server/Plugins/Bundler.py b/src/lib/Server/Plugins/Bundler.py
index 01ad3c78b..bf0c42416 100644
--- a/src/lib/Server/Plugins/Bundler.py
+++ b/src/lib/Server/Plugins/Bundler.py
@@ -3,6 +3,7 @@ __revision__ = '$Revision$'
import copy
import lxml.etree
+import os
import re
import sys
@@ -74,8 +75,8 @@ class Bundler(Bcfg2.Server.Plugin.Plugin,
"""Build all structures for client (metadata)."""
bundleset = []
for bundlename in metadata.bundles:
- entries = [item for (key, item) in list(self.entries.items()) if \
- self.patterns.match(key).group('name') == bundlename]
+ entries = [item for (key, item) in self.entries.items() if \
+ self.patterns.match(os.path.basename(key)).group('name') == bundlename]
if len(entries) == 0:
continue
elif len(entries) == 1: