summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2005-12-07 00:12:31 +0000
committerNarayan Desai <desai@mcs.anl.gov>2005-12-07 00:12:31 +0000
commit2769d83e0b648d1d623b4a1648973d6c32945b13 (patch)
tree369f7e55fa0640939bad76998807dede33785fa2
parentca9bc79f042ad01bcd6ced351e4dd7aef5196376 (diff)
downloadbcfg2-2769d83e0b648d1d623b4a1648973d6c32945b13.tar.gz
bcfg2-2769d83e0b648d1d623b4a1648973d6c32945b13.tar.bz2
bcfg2-2769d83e0b648d1d623b4a1648973d6c32945b13.zip
Fix error reporting for parse failures
Fix comment printing for etc/metadata.xml Add a better error message for client communication bootstrapping failures git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@1615 ce84e21b-d406-0410-9b95-82705330c041
-rw-r--r--debian/bcfg2-server.init1
-rw-r--r--debian/control2
-rw-r--r--src/lib/Server/Metadata.py4
-rw-r--r--src/lib/Server/Plugin.py2
-rw-r--r--src/sbin/bcfg27
5 files changed, 12 insertions, 4 deletions
diff --git a/debian/bcfg2-server.init b/debian/bcfg2-server.init
index 6c14d5a45..1baf44f08 100644
--- a/debian/bcfg2-server.init
+++ b/debian/bcfg2-server.init
@@ -33,6 +33,7 @@ case "$1" in
;;
restart)
$0 stop
+ sleep 5
$0 start
;;
force-reload)
diff --git a/debian/control b/debian/control
index 2e4a1f0f6..be50aba98 100644
--- a/debian/control
+++ b/debian/control
@@ -15,7 +15,7 @@ Description: build configuration system
Package: bcfg2-server
Architecture: all
-Depends: ${python:Depends}, bcfg2, python-lxml (>= 0.8), python-fam | python2.3-gamin, m2crypto
+Depends: ${python:Depends}, bcfg2, python-lxml (>= 0.8), python-fam | python2.3-gamin, m2crypto, libxml2-utils
Description: build configuration system, version two
Bcfg2 is a symbolic configuration management system,
produced at Argonne National Lab.
diff --git a/src/lib/Server/Metadata.py b/src/lib/Server/Metadata.py
index 957179751..47bbb3ecb 100644
--- a/src/lib/Server/Metadata.py
+++ b/src/lib/Server/Metadata.py
@@ -1,7 +1,7 @@
'''This file stores persistent metadata for the BCFG Configuration Repository'''
__revision__ = '$Revision$'
-from lxml.etree import XML, SubElement, Element
+from lxml.etree import XML, SubElement, Element, _Comment, tostring
from syslog import syslog, LOG_ERR, LOG_INFO
from Bcfg2.Server.Plugin import SingleXMLFileBacked
@@ -106,6 +106,8 @@ class MetadataStore(SingleXMLFileBacked):
def pretty_print(self, element, level=0):
'''Produce a pretty-printed text representation of element'''
+ if isinstance(element, _Comment):
+ return (level * " ") + tostring(element)
if element.text:
fmt = "%s<%%s %%s>%%s</%%s>" % (level*" ")
data = (element.tag, (" ".join(["%s='%s'" % (key, element.attrib[key]) for key in element.attrib])),
diff --git a/src/lib/Server/Plugin.py b/src/lib/Server/Plugin.py
index 7139d21ab..262d6092d 100644
--- a/src/lib/Server/Plugin.py
+++ b/src/lib/Server/Plugin.py
@@ -194,7 +194,7 @@ class ScopedXMLFile(SingleXMLFileBacked):
xdata = XML(self.data)
except XMLSyntaxError, msg:
syslog(LOG_ERR, "Failed to parse %s"%(self.name))
- syslog(LOG_ERR, msg)
+ # need to add in lxml error messages, once they are supported
return
self.store = {}
for entry in [ent for ent in xdata.getchildren() if not isinstance(ent, _Comment)]:
diff --git a/src/sbin/bcfg2 b/src/sbin/bcfg2
index a2d0634f5..7a7eb7f77 100644
--- a/src/sbin/bcfg2
+++ b/src/sbin/bcfg2
@@ -97,7 +97,12 @@ if __name__ == '__main__':
cf = ConfigParser()
cf.read('/etc/bcfg2.conf')
- location = cf.get("components", "bcfg2")
+ try:
+ location = cf.get("components", "bcfg2")
+ except (NoSectionError, NoOptionError):
+ print "Can't find bcfg2 server location to connect to"
+ print "Check /etc/bcfg2.conf"
+ raise SystemExit, 1
proxy = ServerProxy(location)
user = 'root'
retries = 0