summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander@sulfrian.net>2015-04-18 23:19:04 +0200
committerAlexander Sulfrian <alexander@sulfrian.net>2015-04-18 23:19:04 +0200
commit79838c23f2d9b2615c11fa460ed972ad6833c6fd (patch)
treec53545187106d687be56b1761ed5608376bc71a7 /src
parent04c357d9bba17696af0ce47bd20c4898527b6ca2 (diff)
downloadbcfg2-79838c23f2d9b2615c11fa460ed972ad6833c6fd.tar.gz
bcfg2-79838c23f2d9b2615c11fa460ed972ad6833c6fd.tar.bz2
bcfg2-79838c23f2d9b2615c11fa460ed972ad6833c6fd.zip
Server: Ignore directories containing a .bcfg2-ignore file
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.
Diffstat (limited to 'src')
-rw-r--r--src/lib/Bcfg2/Server/Plugin/helpers.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/lib/Bcfg2/Server/Plugin/helpers.py b/src/lib/Bcfg2/Server/Plugin/helpers.py
index 5cfc8998c..245cfc256 100644
--- a/src/lib/Bcfg2/Server/Plugin/helpers.py
+++ b/src/lib/Bcfg2/Server/Plugin/helpers.py
@@ -456,7 +456,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: