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>2013-02-06 13:59:47 -0500
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2013-02-06 13:59:47 -0500
commit03b9d1774ad1c89eb51e7fc24f6b47267f9bb474 (patch)
tree04d80636e5b32c0f0f4af4c18d16fe3d1be8017a /src/lib/Bcfg2/Server/Plugins/Packages/__init__.py
parente52a1299f5cc121d84d7fc3b4f01594fcae030c1 (diff)
downloadbcfg2-03b9d1774ad1c89eb51e7fc24f6b47267f9bb474.tar.gz
bcfg2-03b9d1774ad1c89eb51e7fc24f6b47267f9bb474.tar.bz2
bcfg2-03b9d1774ad1c89eb51e7fc24f6b47267f9bb474.zip
Packages: fixed several bugs that could cause duplicate Package entries
Diffstat (limited to 'src/lib/Bcfg2/Server/Plugins/Packages/__init__.py')
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Packages/__init__.py26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/lib/Bcfg2/Server/Plugins/Packages/__init__.py b/src/lib/Bcfg2/Server/Plugins/Packages/__init__.py
index f30e060bd..f112c65cd 100644
--- a/src/lib/Bcfg2/Server/Plugins/Packages/__init__.py
+++ b/src/lib/Bcfg2/Server/Plugins/Packages/__init__.py
@@ -314,19 +314,16 @@ class Packages(Bcfg2.Server.Plugin.Plugin,
if collection is None:
collection = self.get_collection(metadata)
- # initial is the set of packages that are explicitly specified
- # in the configuration
- initial = set()
- # base is the set of initial packages with groups expanded
+ # base is the set of initial packages -- explicitly
+ # given in the specification, from expanded package groups,
+ # and essential to the distribution
base = set()
- # essential pkgs are those marked as such by the distribution
- essential = collection.get_essential()
to_remove = []
groups = []
for struct in structures:
for pkg in struct.xpath('//Package | //BoundPackage'):
if pkg.get("name"):
- initial.update(collection.packages_from_entry(pkg))
+ base.update(collection.packages_from_entry(pkg))
elif pkg.get("group"):
groups.append((pkg.get("group"),
pkg.get("type")))
@@ -338,21 +335,24 @@ class Packages(Bcfg2.Server.Plugin.Plugin,
pkg,
xml_declaration=False).decode('UTF-8'))
+ # remove package groups
+ for el in to_remove:
+ el.getparent().remove(el)
+
gpkgs = collection.get_groups(groups)
for pkgs in gpkgs.values():
base.update(pkgs)
- base.update(initial | essential)
- for el in to_remove:
- el.getparent().remove(el)
+ # essential pkgs are those marked as such by the distribution
+ base.update(collection.get_essential())
packages, unknown = collection.complete(base)
if unknown:
self.logger.info("Packages: Got %d unknown entries" % len(unknown))
self.logger.info("Packages: %s" % list(unknown))
- newpkgs = collection.get_new_packages(initial, packages)
- self.debug_log("Packages: %d initial, %d complete, %d new" %
- (len(initial), len(packages), len(newpkgs)))
+ newpkgs = collection.get_new_packages(base, packages)
+ self.debug_log("Packages: %d base, %d complete, %d new" %
+ (len(base), len(packages), len(newpkgs)))
newpkgs.sort()
collection.packages_to_entry(newpkgs, independent)