diff options
author | Narayan Desai <desai@mcs.anl.gov> | 2006-09-15 15:50:56 +0000 |
---|---|---|
committer | Narayan Desai <desai@mcs.anl.gov> | 2006-09-15 15:50:56 +0000 |
commit | b11dc8dc0b60422ec758b1096c93674cad09a562 (patch) | |
tree | 9a5ad7979b5a7554b5e48a024694c32848609113 | |
parent | 4c912439a255c7616cfe3aa034e94469898375d2 (diff) | |
download | bcfg2-b11dc8dc0b60422ec758b1096c93674cad09a562.tar.gz bcfg2-b11dc8dc0b60422ec758b1096c93674cad09a562.tar.bz2 bcfg2-b11dc8dc0b60422ec758b1096c93674cad09a562.zip |
Implement upstream event suppression with logging (Resolves Ticket #111)
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@2264 ce84e21b-d406-0410-9b95-82705330c041
-rw-r--r-- | src/lib/Server/Core.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/lib/Server/Core.py b/src/lib/Server/Core.py index 6f11e83e7..00d7d41cb 100644 --- a/src/lib/Server/Core.py +++ b/src/lib/Server/Core.py @@ -9,6 +9,16 @@ import logging, lxml.etree, os, stat, Bcfg2.Server.Metadata, ConfigParser logger = logging.getLogger('Bcfg2.Core') +def ShouldIgnore(event): + '''Test if the event should be suppresed''' + if event.filename.split('/')[-1] == '.svn': + return True + if event.filename.endswith('~') or event.filename.endswith('.tmp') + or event.filename.endswith('.tmp'): + logger.error("Suppressing event for file %s" % (event.filename)) + return True + return False + class CoreInitError(Exception): '''This error is raised when the core cannot be initialized''' pass @@ -66,8 +76,7 @@ class FamFam(object): unique = [] bookkeeping = [] for event in rawevents: - if event.filename.split('/')[-1] == '.svn': - # ignore svn directories + if ShouldIgnore(event): continue if event.code2str() != 'changed': # process all non-change events @@ -148,8 +157,7 @@ class GaminFam(object): unique = [] bookkeeping = [] for event in self.events: - if event.filename.split('/')[-1] == '.svn': - # skip svn directories + if ShouldIgnore(event): continue if event.code2str() != 'changed': # process all non-change events |