summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2014-05-15 09:04:46 -0400
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2014-05-15 09:13:16 -0400
commit94240fb128c3d19a7e013b0960da5dba5b1c0f30 (patch)
treeb7f3dc6c96a5aca09ec873c22a9b6f72b93d128f
parent9fece077393cec3fe0ac540b30eaa9a67b1a3d49 (diff)
downloadbcfg2-94240fb128c3d19a7e013b0960da5dba5b1c0f30.tar.gz
bcfg2-94240fb128c3d19a7e013b0960da5dba5b1c0f30.tar.bz2
bcfg2-94240fb128c3d19a7e013b0960da5dba5b1c0f30.zip
XMLFileBacked: Watch XIncluded files that do not exist
This makes a best effort to watch XIncluded files that do not exist. Assume that you have XIncluded ``foo.xml``, the following (currently) fails: mv foo.xml /tmp mv /tmp/foo.xml . Bcfg2 processes the deletion event, and stops watching ``foo.xml``; consequently, it receives no creation event when you put ``foo.xml`` back. This does not fix the situation where you add a new file that is matched by a wildcard XInclude, which turns out to be much more difficult, and will likely require a significant restructuring of how wildcard XIncludes are processed. (I.e., we'll need to place a monitor on the directory or directories where the wildcard XInclude is looking, and then filter events according to the wildcard.)
-rw-r--r--src/lib/Bcfg2/Server/Plugin/helpers.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/lib/Bcfg2/Server/Plugin/helpers.py b/src/lib/Bcfg2/Server/Plugin/helpers.py
index 170af50ac..55dd255cd 100644
--- a/src/lib/Bcfg2/Server/Plugin/helpers.py
+++ b/src/lib/Bcfg2/Server/Plugin/helpers.py
@@ -581,7 +581,13 @@ class XMLFileBacked(FileBacked):
if el.findall('./%sfallback' % Bcfg2.Server.XI_NAMESPACE):
self.logger.debug(msg)
else:
- self.logger.warning(msg)
+ self.logger.error(msg)
+ # add a FAM monitor for this path. this isn't perfect
+ # -- if there's an xinclude of "*.xml", we'll watch
+ # the literal filename "*.xml". but for non-globbing
+ # filenames, it works fine.
+ if fpath not in self.extra_monitors:
+ self.add_monitor(fpath)
parent = el.getparent()
parent.remove(el)