summaryrefslogtreecommitdiffstats
path: root/src/lib/Server/Plugins/Packages
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2012-01-24 09:17:40 -0500
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2012-01-24 09:17:40 -0500
commit987fd6364887184bf201a0a68f6903cec6cc5d84 (patch)
treefd666391d5408e3d294ad2f5583fdebd8f530106 /src/lib/Server/Plugins/Packages
parent4367811c2811d0305cd2be8a1bb7b44fff7a1329 (diff)
downloadbcfg2-987fd6364887184bf201a0a68f6903cec6cc5d84.tar.gz
bcfg2-987fd6364887184bf201a0a68f6903cec6cc5d84.tar.bz2
bcfg2-987fd6364887184bf201a0a68f6903cec6cc5d84.zip
improved Packages debug info, added packageresolve and packagesources bcfg2-info commands
Diffstat (limited to 'src/lib/Server/Plugins/Packages')
-rw-r--r--src/lib/Server/Plugins/Packages/__init__.py23
1 files changed, 10 insertions, 13 deletions
diff --git a/src/lib/Server/Plugins/Packages/__init__.py b/src/lib/Server/Plugins/Packages/__init__.py
index 29f4cacd9..ae8dc54db 100644
--- a/src/lib/Server/Plugins/Packages/__init__.py
+++ b/src/lib/Server/Plugins/Packages/__init__.py
@@ -75,16 +75,14 @@ class Packages(Bcfg2.Server.Plugin.Plugin,
'type': 'file',
'perms': '0644'}
- collection = Collection.factory(metadata, self.sources, self.data,
- debug=self.debug_flag)
+ collection = self._get_collection(metadata)
entry.text = collection.get_config()
for (key, value) in list(attrib.items()):
entry.attrib.__setitem__(key, value)
def HandleEntry(self, entry, metadata):
if entry.tag == 'Package':
- collection = Collection.factory(metadata, self.sources, self.data,
- debug=self.debug_flag)
+ collection = self._get_collection(metadata)
entry.set('version', 'auto')
entry.set('type', collection.ptype)
elif entry.tag == 'Path':
@@ -98,9 +96,7 @@ class Packages(Bcfg2.Server.Plugin.Plugin,
if entry.tag == 'Package':
if self.config.getboolean("global", "magic_groups",
default=True) == True:
- collection = Collection.factory(metadata, self.sources,
- self.data,
- debug=self.debug_flag)
+ collection = self._get_collection(metadata)
if collection.magic_groups_match():
return True
else:
@@ -121,8 +117,7 @@ class Packages(Bcfg2.Server.Plugin.Plugin,
metadata - client metadata instance
structures - a list of structure-stage entry combinations
'''
- collection = Collection.factory(metadata, self.sources, self.data,
- debug=self.debug_flag)
+ collection = self._get_collection(metadata)
indep = lxml.etree.Element('Independent')
self._build_packages(metadata, indep, structures,
collection=collection)
@@ -138,8 +133,7 @@ class Packages(Bcfg2.Server.Plugin.Plugin,
return
if collection is None:
- collection = Collection.factory(metadata, self.sources, self.data,
- debug=self.debug_flag)
+ collection = self._get_collection(metadata)
# initial is the set of packages that are explicitly specified
# in the configuration
initial = set()
@@ -256,7 +250,10 @@ class Packages(Bcfg2.Server.Plugin.Plugin,
if kfile not in keyfiles:
os.unlink(kfile)
+ def _get_collection(self, metadata):
+ return Collection.factory(metadata, self.sources, self.data,
+ debug=self.debug_flag)
+
def get_additional_data(self, metadata):
- collection = Collection.factory(metadata, self.sources, self.data,
- debug=self.debug_flag)
+ collection = self._get_collection(metadata)
return dict(sources=collection.get_additional_data())