diff options
author | Narayan Desai <desai@mcs.anl.gov> | 2006-03-17 21:41:18 +0000 |
---|---|---|
committer | Narayan Desai <desai@mcs.anl.gov> | 2006-03-17 21:41:18 +0000 |
commit | 49eff48eabcae69fb4e8cf40961a7e130bf9d41f (patch) | |
tree | a0ce8d92a83ef27cb6a43b5aaeb23630e54f6b1d /src/lib | |
parent | 53bf23b62ae561f6525e4d4eb1396590125988b6 (diff) | |
download | bcfg2-49eff48eabcae69fb4e8cf40961a7e130bf9d41f.tar.gz bcfg2-49eff48eabcae69fb4e8cf40961a7e130bf9d41f.tar.bz2 bcfg2-49eff48eabcae69fb4e8cf40961a7e130bf9d41f.zip |
* Implement svn repository revision detection
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@1806 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/Server/Core.py | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/lib/Server/Core.py b/src/lib/Server/Core.py index 6d493a6da..0841d0c6f 100644 --- a/src/lib/Server/Core.py +++ b/src/lib/Server/Core.py @@ -87,6 +87,7 @@ class FamFam(object): end = time() logger.info("Processed %s fam events in %03.03f seconds. %s coalesced" % (count, (end - start), collapsed)) + return count class GaminEvent(object): '''This class provides an event analogous to python-fam events based on gamin sources''' @@ -172,6 +173,7 @@ class GaminFam(object): end = time() logger.info("Processed %s gamin events in %03.03f seconds. %s collapsed" % (count, (end - start), collapsed)) + return count try: from gamin import WatchMonitor, GAMCreated, GAMExists, GAMEndExist, GAMChanged, GAMDeleted @@ -202,6 +204,11 @@ class Core(object): self.cron = {} self.setup = setup self.plugins = {} + try: + self.svn = cfile.get('server', 'svn') == 'yes' + except: + self.svn = False + self.revision = '-1' mpath = cfile.get('server','repository') try: @@ -253,6 +260,9 @@ class Core(object): self.Bind(entry, metadata) except PluginExecutionError: logger.error("Failed to bind entry: %s %s" % (entry.tag, entry.get('name'))) + except: + logger.error("Unexpected failure in BindStructure: %s %s" % (entry.tag, entry.get('name')), + exc_info=1) def Bind(self, entry, metadata): '''Bind an entry using the appropriate generator''' @@ -296,7 +306,8 @@ class Core(object): '''Perform periodic update tasks''' while self.fam.fm.pending: try: - self.fam.HandleEvent() + if self.fam.HandleEvent() and self.svn: + self.read_svn_revision() except: logger.error("error in FamEvent", exc_info=1) try: @@ -304,3 +315,8 @@ class Core(object): except: logger.error("error in Statistics", exc_info=1) + def read_svn_revision(self): + '''Read svn revision information for the bcfg2 repository''' + revline = [line.split(': ')[1].strip() for line in os.popen("svn info %s" % (self.datastore)).readlines() if + line[:9] == 'Revision:'][-1] + self.revision = revline |