summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2009-03-16 01:33:13 +0000
committerNarayan Desai <desai@mcs.anl.gov>2009-03-16 01:33:13 +0000
commit960af8f858bf54a1ebfb57b836dfb61c661fe3f1 (patch)
treeddc5f5bfbc945790a7bdbc03ea1c1b30651709a9 /src
parent3e82d2a31acd4a30211ac51b2d80d7d00b1bda57 (diff)
downloadbcfg2-960af8f858bf54a1ebfb57b836dfb61c661fe3f1.tar.gz
bcfg2-960af8f858bf54a1ebfb57b836dfb61c661fe3f1.tar.bz2
bcfg2-960af8f858bf54a1ebfb57b836dfb61c661fe3f1.zip
Server: Implement config checksum support for slow links
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5121 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src')
-rwxr-xr-xsrc/sbin/bcfg2-server15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/sbin/bcfg2-server b/src/sbin/bcfg2-server
index c80655528..282d3fde9 100755
--- a/src/sbin/bcfg2-server
+++ b/src/sbin/bcfg2-server
@@ -9,7 +9,7 @@ from Bcfg2.Server.Core import Core, CoreInitError
from xmlrpclib import Fault
from lxml.etree import XML, Element, tostring
-import logging, select, socket, sys, time
+import logging, md5, select, socket, sys, time
import Bcfg2.Logger, Bcfg2.Options, Bcfg2.Component, Bcfg2.Daemon
logger = logging.getLogger('bcfg2-server')
@@ -164,12 +164,19 @@ class Bcfg2Serv(Bcfg2.Component.Component):
raise Fault, (6, warning)
return True
- def Bcfg2GetConfig(self, address, _=False, profile=False):
+ def Bcfg2GetConfig(self, address, checksum=False):
'''Build config for a client'''
try:
client = self.Core.metadata.resolve_client(address)
- return tostring(self.Core.BuildConfiguration(client),
- encoding='UTF-8', xml_declaration=True)
+ config = self.Core.BuildConfiguration(client)
+ print checksum
+ if checksum:
+ for cfile in config.findall('.//ConfigFile'):
+ if cfile.text != None:
+ csum = md5.md5(cfile.text)
+ cfile.set('checksum', csum.hexdigest())
+ cfile.text = None
+ return tostring(config, encoding='UTF-8', xml_declaration=True)
except Bcfg2.Server.Plugins.Metadata.MetadataConsistencyError:
self.logger.warning("Metadata consistency failure for %s" % (address))
raise Fault, (6, "Metadata consistency failure")