summaryrefslogtreecommitdiffstats
path: root/src/lib/Bcfg2/Server/Plugins/Probes.py
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2013-08-07 11:37:38 -0400
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2013-08-07 13:28:47 -0400
commit7e9787c947e99b68317f5420951a296cea858daa (patch)
treeebd7605737b8e9a9a35a8bfa58adf312c9fa0c49 /src/lib/Bcfg2/Server/Plugins/Probes.py
parent441a96457ba55529c0316a7459dcb295988824b0 (diff)
downloadbcfg2-7e9787c947e99b68317f5420951a296cea858daa.tar.gz
bcfg2-7e9787c947e99b68317f5420951a296cea858daa.tar.bz2
bcfg2-7e9787c947e99b68317f5420951a296cea858daa.zip
Plugin: added new Caching interface
This gives a single unified interface for expiring caches, no matter the plugin. This will be particularly useful with the MultiprocessingCore, as certain calls must be dispatched to child processes to expire their caches.
Diffstat (limited to 'src/lib/Bcfg2/Server/Plugins/Probes.py')
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Probes.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/lib/Bcfg2/Server/Plugins/Probes.py b/src/lib/Bcfg2/Server/Plugins/Probes.py
index bf59809f7..b9f93052a 100644
--- a/src/lib/Bcfg2/Server/Plugins/Probes.py
+++ b/src/lib/Bcfg2/Server/Plugins/Probes.py
@@ -181,14 +181,16 @@ class ProbeSet(Bcfg2.Server.Plugin.EntrySet):
class Probes(Bcfg2.Server.Plugin.Probing,
+ Bcfg2.Server.Plugin.Caching,
Bcfg2.Server.Plugin.Connector,
Bcfg2.Server.Plugin.DatabaseBacked):
""" A plugin to gather information from a client machine """
__author__ = 'bcfg-dev@mcs.anl.gov'
def __init__(self, core, datastore):
- Bcfg2.Server.Plugin.Connector.__init__(self)
Bcfg2.Server.Plugin.Probing.__init__(self)
+ Bcfg2.Server.Plugin.Caching.__init__(self)
+ Bcfg2.Server.Plugin.Connector.__init__(self)
Bcfg2.Server.Plugin.DatabaseBacked.__init__(self, core, datastore)
try:
@@ -266,6 +268,9 @@ class Probes(Bcfg2.Server.Plugin.Probing,
hostname=client.hostname).exclude(
group__in=self.cgroups[client.hostname]).delete()
+ def expire_cache(self, key=None):
+ self.load_data(client=key)
+
def load_data(self, client=None):
""" Load probe data from the appropriate backend (probed.xml
or the database) """
@@ -299,7 +304,7 @@ class Probes(Bcfg2.Server.Plugin.Probing,
self.cgroups[client.get('name')].append(pdata.get('name'))
if self.core.metadata_cache_mode in ['cautious', 'aggressive']:
- self.core.metadata_cache.expire()
+ self.core.expire_caches_by_type(Bcfg2.Server.Plugin.Metadata)
def _load_data_db(self, client=None):
""" Load probe data from the database """
@@ -325,7 +330,8 @@ class Probes(Bcfg2.Server.Plugin.Probing,
self.cgroups[pgroup.hostname].append(pgroup.group)
if self.core.metadata_cache_mode in ['cautious', 'aggressive']:
- self.core.metadata_cache.expire(client)
+ self.core.expire_caches_by_type(Bcfg2.Server.Plugin.Metadata,
+ key=client)
@Bcfg2.Server.Plugin.track_statistics()
def GetProbes(self, meta):