From dc4a28c0bb59edc9385d6860ed1b7defeeacde42 Mon Sep 17 00:00:00 2001 From: Narayan Desai Date: Thu, 30 Mar 2006 16:20:07 +0000 Subject: * Add error handling for svn revision check * Add documentation to the bcfg2.conf man page git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@1823 ce84e21b-d406-0410-9b95-82705330c041 --- man/bcfg2.conf.5 | 2 ++ src/lib/Server/Core.py | 13 +++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/man/bcfg2.conf.5 b/man/bcfg2.conf.5 index f049f6994..feebcb05a 100644 --- a/man/bcfg2.conf.5 +++ b/man/bcfg2.conf.5 @@ -14,6 +14,8 @@ structures=list of enabled structures .TP bundles=list of enabled bundles .TP +svn=(yes|no) (Repository is svn managed) +.TP .B [communication] .TP password=communication password diff --git a/src/lib/Server/Core.py b/src/lib/Server/Core.py index 7820cfca4..a1c9db9eb 100644 --- a/src/lib/Server/Core.py +++ b/src/lib/Server/Core.py @@ -206,9 +206,10 @@ class Core(object): self.plugins = {} try: self.svn = cfile.get('server', 'svn') == 'yes' + self.read_svn_revision() except: self.svn = False - self.revision = '-1' + self.revision = '-1' mpath = cfile.get('server','repository') try: @@ -314,6 +315,10 @@ class Core(object): 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 + try: + revline = [line.split(': ')[1].strip() for line in os.popen("svn info %s" % (self.datastore)).readlines() if + line[:9] == 'Revision:'][-1] + self.revision = revline + except IndexError: + logger.error("Failed to read svn info; disabling svn support") + self.svn = False -- cgit v1.2.3-1-g7c22