summaryrefslogtreecommitdiffstats
path: root/src/lib/Bcfg2/Server/Plugins/Packages/__init__.py
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2012-09-17 10:31:38 -0400
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2012-09-20 11:37:55 -0400
commit1587dcb17c310d5ffb22bd7060c1cf18696eba28 (patch)
tree76105afb0a1fc7657d884939cd65c5ca4d9dc962 /src/lib/Bcfg2/Server/Plugins/Packages/__init__.py
parentaf07f60e2e5c9c26ab1ef1d0ecc0565672a85f56 (diff)
downloadbcfg2-1587dcb17c310d5ffb22bd7060c1cf18696eba28.tar.gz
bcfg2-1587dcb17c310d5ffb22bd7060c1cf18696eba28.tar.bz2
bcfg2-1587dcb17c310d5ffb22bd7060c1cf18696eba28.zip
development docs for Packages: Collection docs written
Diffstat (limited to 'src/lib/Bcfg2/Server/Plugins/Packages/__init__.py')
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Packages/__init__.py24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/lib/Bcfg2/Server/Plugins/Packages/__init__.py b/src/lib/Bcfg2/Server/Plugins/Packages/__init__.py
index a4c0f98ca..40bcabae9 100644
--- a/src/lib/Bcfg2/Server/Plugins/Packages/__init__.py
+++ b/src/lib/Bcfg2/Server/Plugins/Packages/__init__.py
@@ -1,7 +1,5 @@
import os
import sys
-import time
-import copy
import glob
import shutil
import lxml.etree
@@ -14,6 +12,7 @@ from Bcfg2.Server.Plugins.Packages.PackagesSources import PackagesSources
yum_config_default = "/etc/yum.repos.d/bcfg2.repo"
apt_config_default = "/etc/apt/sources.d/bcfg2"
+
class Packages(Bcfg2.Server.Plugin.Plugin,
Bcfg2.Server.Plugin.StructureValidator,
Bcfg2.Server.Plugin.Generator,
@@ -176,9 +175,11 @@ class Packages(Bcfg2.Server.Plugin.Plugin,
pkg.get("type")))
to_remove.append(pkg)
else:
- self.logger.error("Packages: Malformed Package: %s" %
- lxml.etree.tostring(pkg,
- xml_declaration=False).decode('UTF-8'))
+ self.logger.error(
+ "Packages: Malformed Package: %s" %
+ lxml.etree.tostring(
+ pkg,
+ xml_declaration=False).decode('UTF-8'))
gpkgs = collection.get_groups(groups)
for group, pkgs in gpkgs.items():
@@ -225,7 +226,7 @@ class Packages(Bcfg2.Server.Plugin.Plugin,
self.sentinels = set()
cachefiles = set()
- for collection in list(Collection.collections.values()):
+ for collection in list(Collection.COLLECTIONS.values()):
cachefiles.update(collection.cachefiles)
if not self.disableMetaData:
collection.setup_data(force_update)
@@ -262,7 +263,8 @@ class Packages(Bcfg2.Server.Plugin.Plugin,
keyfiles.append(localfile)
if ((force_update and key not in keys) or
not os.path.exists(localfile)):
- self.logger.info("Packages: Downloading and parsing %s" % key)
+ self.logger.info("Packages: Downloading and parsing %s" %
+ key)
response = urlopen(key)
open(localfile, 'w').write(response.read())
keys.append(key)
@@ -272,8 +274,8 @@ class Packages(Bcfg2.Server.Plugin.Plugin,
os.unlink(kfile)
def _get_collection(self, metadata):
- return Collection.factory(metadata, self.sources, self.data,
- debug=self.debug_flag)
+ return Collection.Collection(metadata, self.sources, self.data,
+ debug=self.debug_flag)
def get_additional_data(self, metadata):
collection = self._get_collection(metadata)
@@ -282,8 +284,8 @@ class Packages(Bcfg2.Server.Plugin.Plugin,
def end_client_run(self, metadata):
""" clear the collection cache for this client, which must
persist only the duration of a client run"""
- if metadata.hostname in Collection.clients:
- del Collection.clients[metadata.hostname]
+ if metadata.hostname in Collection.CLIENTS:
+ del Collection.CLIENTS[metadata.hostname]
def end_statistics(self, metadata):
self.end_client_run(metadata)