summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander@sulfrian.net>2015-04-18 23:19:04 +0200
committerAlexander Sulfrian <alexander@sulfrian.net>2015-04-29 17:46:45 +0200
commitba4cd3aaee4d42b3da690744f74a51de80bde1c2 (patch)
treef23f514a5b41399174b46b3d01e68efa50a1b04a
parentcc4af9966238a6d958b3248e45f3c302d8ba9026 (diff)
downloadbcfg2-1.4.0pre1-spline14.tar.gz
bcfg2-1.4.0pre1-spline14.tar.bz2
bcfg2-1.4.0pre1-spline14.zip
Server: Ignore directories containing a .bcfg2-ignore filev1.4.0pre1-spline14
The DirectoryBacked helper now does not recurse into directories that contains a .bcfg2-ignore file. This makes it possible to ignore some directories for most plugins (Bundler, Defaults, Pkgmgr, Properties, PuppetENC, TemplateHelper, Trigger). You can store for example a python module used by a TemplateHelper in the same directory, without getting strange error messages while TemplateHelper is trying to import each single file of this module.
-rw-r--r--doc/releases/1.4.0pre2.txt3
-rw-r--r--src/lib/Bcfg2/Server/Plugin/helpers.py4
2 files changed, 6 insertions, 1 deletions
diff --git a/doc/releases/1.4.0pre2.txt b/doc/releases/1.4.0pre2.txt
index 572748f73..dc03c5504 100644
--- a/doc/releases/1.4.0pre2.txt
+++ b/doc/releases/1.4.0pre2.txt
@@ -30,6 +30,9 @@ backwards-incompatible user-facing changes
This fixes potentially long client runs when comparing files that have
diverged significantly.
+* Ignore directories containing a .bcfg2-ignore file in various plugins
+ (Bundler, Defaults, Pkgmgr, Properties, PuppetENC, TemplateHelper, Trigger).
+
Thanks
------
diff --git a/src/lib/Bcfg2/Server/Plugin/helpers.py b/src/lib/Bcfg2/Server/Plugin/helpers.py
index 2aab231c6..0eddc575f 100644
--- a/src/lib/Bcfg2/Server/Plugin/helpers.py
+++ b/src/lib/Bcfg2/Server/Plugin/helpers.py
@@ -458,7 +458,9 @@ class DirectoryBacked(Debuggable):
# again without having to add a new monitor.
elif os.path.isdir(abspath):
# Deal with events for directories
- if action in ['exists', 'created']:
+ if os.path.exists(os.path.join(abspath, '.bcfg2-ignore')):
+ self.logger.debug("Ignoring directory %s" % abspath)
+ elif action in ['exists', 'created']:
self.add_directory_monitor(relpath)
elif action == 'changed':
if relpath in self.entries: