summaryrefslogtreecommitdiffstats
path: root/src/lib/Bcfg2/Server/Plugins/Metadata.py
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2012-05-18 10:53:35 -0400
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2012-05-18 16:07:56 -0400
commitbc52f6ac0c56c9551b58fb5110259d87b3a97056 (patch)
treeb0dbe1fa57c47b7cda6d05dfff64b92a6d49973f /src/lib/Bcfg2/Server/Plugins/Metadata.py
parentdbd958c387af890da5e7b455fb409f8e567dce15 (diff)
downloadbcfg2-bc52f6ac0c56c9551b58fb5110259d87b3a97056.tar.gz
bcfg2-bc52f6ac0c56c9551b58fb5110259d87b3a97056.tar.bz2
bcfg2-bc52f6ac0c56c9551b58fb5110259d87b3a97056.zip
Added inotify filemonitor driver
Moved list of files to ignore into config
Diffstat (limited to 'src/lib/Bcfg2/Server/Plugins/Metadata.py')
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Metadata.py21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/lib/Bcfg2/Server/Plugins/Metadata.py b/src/lib/Bcfg2/Server/Plugins/Metadata.py
index 0cb4dc087..50604f5cb 100644
--- a/src/lib/Bcfg2/Server/Plugins/Metadata.py
+++ b/src/lib/Bcfg2/Server/Plugins/Metadata.py
@@ -38,13 +38,18 @@ class MetadataRuntimeError(Exception):
class XMLMetadataConfig(Bcfg2.Server.Plugin.SingleXMLFileBacked):
"""Handles xml config files and all XInclude statements"""
def __init__(self, metadata, watch_clients, basefile):
- Bcfg2.Server.Plugin.SingleXMLFileBacked.__init__(self,
- os.path.join(metadata.data,
- basefile),
- metadata.core.fam)
+ # we tell SingleXMLFileBacked _not_ to add a monitor for this
+ # file, because the main Metadata plugin has already added
+ # one. then we immediately set should_monitor to the proper
+ # value, so that XIinclude'd files get properly watched
+ fpath = os.path.join(metadata.data, basefile)
+ Bcfg2.Server.Plugin.SingleXMLFileBacked.__init__(self, fpath,
+ metadata.core.fam,
+ should_monitor=False)
+ self.should_monitor = watch_clients
self.metadata = metadata
+ self.fam = metadata.core.fam
self.basefile = basefile
- self.should_monitor = watch_clients
self.data = None
self.basedata = None
self.basedir = metadata.data
@@ -64,12 +69,6 @@ class XMLMetadataConfig(Bcfg2.Server.Plugin.SingleXMLFileBacked):
raise MetadataRuntimeError
return self.basedata
- def add_monitor(self, fpath, fname):
- """Add a fam monitor for an included file"""
- if self.should_monitor:
- self.metadata.core.fam.AddMonitor(fpath, self.metadata)
- self.extras.append(fname)
-
def load_xml(self):
"""Load changes from XML"""
try: