From 0d13c2b0c40e63672bae4ef18eb945d15a85bb50 Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Tue, 21 May 2013 09:43:42 -0400 Subject: Packages: don't cache package collections with no sources --- src/lib/Bcfg2/Server/Plugins/Packages/__init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/lib/Bcfg2/Server/Plugins') diff --git a/src/lib/Bcfg2/Server/Plugins/Packages/__init__.py b/src/lib/Bcfg2/Server/Plugins/Packages/__init__.py index d5773de97..f82b8a392 100644 --- a/src/lib/Bcfg2/Server/Plugins/Packages/__init__.py +++ b/src/lib/Bcfg2/Server/Plugins/Packages/__init__.py @@ -527,8 +527,9 @@ class Packages(Bcfg2.Server.Plugin.Plugin, collection = cclass(metadata, relevant, self.cachepath, self.data, self.core.fam, debug=self.debug_flag) ckey = collection.cachekey - self.clients[metadata.hostname] = ckey - self.collections[ckey] = collection + if cclass != Collection: + self.clients[metadata.hostname] = ckey + self.collections[ckey] = collection return collection def get_additional_data(self, metadata): -- cgit v1.2.3-1-g7c22 From f55238772edf411cb101f4b179c357fffa665345 Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Tue, 21 May 2013 13:50:49 -0400 Subject: FileProbes: made client probe compatible with bcfg2 1.2 --- src/lib/Bcfg2/Server/Plugins/FileProbes.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/lib/Bcfg2/Server/Plugins') diff --git a/src/lib/Bcfg2/Server/Plugins/FileProbes.py b/src/lib/Bcfg2/Server/Plugins/FileProbes.py index d816192aa..8e074118f 100644 --- a/src/lib/Bcfg2/Server/Plugins/FileProbes.py +++ b/src/lib/Bcfg2/Server/Plugins/FileProbes.py @@ -24,7 +24,11 @@ import sys import pwd import grp import Bcfg2.Client.XML -from Bcfg2.Compat import b64encode, oct_mode +try: + from Bcfg2.Compat import b64encode, oct_mode +except ImportError: + from base64 import b64encode + oct_mode = oct path = "%s" -- cgit v1.2.3-1-g7c22 From 7bfe2b81d22734e559f1335e35ffd720db1ccf0e Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Tue, 21 May 2013 16:20:02 -0400 Subject: Yum: prevent traceback with empty repository --- src/lib/Bcfg2/Server/Plugins/Packages/Yum.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/lib/Bcfg2/Server/Plugins') diff --git a/src/lib/Bcfg2/Server/Plugins/Packages/Yum.py b/src/lib/Bcfg2/Server/Plugins/Packages/Yum.py index 7438c633b..bb7caab0d 100644 --- a/src/lib/Bcfg2/Server/Plugins/Packages/Yum.py +++ b/src/lib/Bcfg2/Server/Plugins/Packages/Yum.py @@ -1120,9 +1120,9 @@ class YumSource(Source): self.packages['global'] = copy.deepcopy(sdata.pop()) except IndexError: self.logger.error("Packages: No packages in repo") + self.packages['global'] = set() while sdata: - self.packages['global'] = \ - self.packages['global'].intersection(sdata.pop()) + self.packages['global'].update(sdata.pop()) for key in self.packages: if key == 'global': -- cgit v1.2.3-1-g7c22 From 6fffddf1cc3e73bf831fb3bbe36c928d1ebb8c77 Mon Sep 17 00:00:00 2001 From: Michael Fenn Date: Fri, 24 May 2013 12:11:55 -0400 Subject: Cfg: Handle bogus created events as changed It is possible for the FAM (gamin in particular) to send a created event for a file that already exists if the file is updated in a particular way. I suppose that the event is technically correct since a new inode really was created, but the file is only changed from bcfg2's point of view. For instance, the "atomic" copy-to-temp-then-move-over-top method that rsync uses will expose this behavior. Example: rsync -a --temp-dir=/var/tmp --delete-after \ --exclude Packages/cache --exclude Packages/keys \ --exclude Reporting/DirectStore --exclude probed.xml \ /var/lib/bcfg2/ $OTHERSERVER:/var/lib/bcfg2 --- src/lib/Bcfg2/Server/Plugins/Cfg/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/lib/Bcfg2/Server/Plugins') diff --git a/src/lib/Bcfg2/Server/Plugins/Cfg/__init__.py b/src/lib/Bcfg2/Server/Plugins/Cfg/__init__.py index ffe93c25b..c6ac9d8dc 100644 --- a/src/lib/Bcfg2/Server/Plugins/Cfg/__init__.py +++ b/src/lib/Bcfg2/Server/Plugins/Cfg/__init__.py @@ -520,7 +520,9 @@ class CfgEntrySet(Bcfg2.Server.Plugin.EntrySet, return elif hdlr.ignore(event, basename=self.path): return - elif action == 'changed': + # we only get here if event.filename in self.entries, so handle + # created event like changed + elif action == 'changed' or action == 'created': self.entries[event.filename].handle_event(event) return elif action == 'deleted': -- cgit v1.2.3-1-g7c22