diff options
author | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2013-08-09 10:01:51 -0400 |
---|---|---|
committer | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2013-08-09 10:02:30 -0400 |
commit | 97a5cfd668ec7e0ff64c03acbf1076ca43daa169 (patch) | |
tree | 4b88ba3b0e2bbb6667d62796a41df3cd230bc10d /src/lib/Bcfg2/Server/Plugins/Packages/__init__.py | |
parent | ff4fc8d1a569a0cde58e198152c80d342c40332b (diff) | |
download | bcfg2-97a5cfd668ec7e0ff64c03acbf1076ca43daa169.tar.gz bcfg2-97a5cfd668ec7e0ff64c03acbf1076ca43daa169.tar.bz2 bcfg2-97a5cfd668ec7e0ff64c03acbf1076ca43daa169.zip |
Packages: always add collections to group/package cache
This fixes cases where the collection itself would not be cached
because a host had no sources, or multiple sources of different types;
we still want to cache package group results and package sets (both of
which will be empty).
Diffstat (limited to 'src/lib/Bcfg2/Server/Plugins/Packages/__init__.py')
-rw-r--r-- | src/lib/Bcfg2/Server/Plugins/Packages/__init__.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/lib/Bcfg2/Server/Plugins/Packages/__init__.py b/src/lib/Bcfg2/Server/Plugins/Packages/__init__.py index 4096153a3..3cdcdc162 100644 --- a/src/lib/Bcfg2/Server/Plugins/Packages/__init__.py +++ b/src/lib/Bcfg2/Server/Plugins/Packages/__init__.py @@ -573,8 +573,12 @@ class Packages(Bcfg2.Server.Plugin.Plugin, if not self.sources.loaded: # if sources.xml has not received a FAM event yet, defer; # instantiate a dummy Collection object - return Collection(metadata, [], self.cachepath, self.data, - self.core.fam) + collection = Collection(metadata, [], self.cachepath, self.data, + self.core.fam) + ckey = collection.cachekey + self.groupcache.setdefault(ckey, dict()) + self.pkgcache.setdefault(ckey, dict()) + return collection if metadata.hostname in self.clients: return self.collections[self.clients[metadata.hostname]] @@ -611,8 +615,8 @@ class Packages(Bcfg2.Server.Plugin.Plugin, if cclass != Collection: self.clients[metadata.hostname] = ckey self.collections[ckey] = collection - self.groupcache.setdefault(ckey, dict()) - self.pkgcache.setdefault(ckey, dict()) + self.groupcache.setdefault(ckey, dict()) + self.pkgcache.setdefault(ckey, dict()) return collection def get_additional_data(self, metadata): |