From 18b9808b79bbed11a06b598d259152795111c0d0 Mon Sep 17 00:00:00 2001 From: Narayan Desai Date: Wed, 13 Feb 2008 02:24:23 +0000 Subject: revert mistaken bcfg2-server commit [bugfix] git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@4377 ce84e21b-d406-0410-9b95-82705330c041 --- src/sbin/bcfg2-server | 40 ++++++++++++---------------------------- 1 file changed, 12 insertions(+), 28 deletions(-) diff --git a/src/sbin/bcfg2-server b/src/sbin/bcfg2-server index f5128e7fd..cb27e9c89 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, os, select, signal, socket, sys, time +import logging, select, signal, socket, sys import Bcfg2.Logging, Bcfg2.Options, Bcfg2.Component, Bcfg2.Daemon logger = logging.getLogger('bcfg2-server') @@ -27,7 +27,7 @@ class Bcfg2Serv(Bcfg2.Component.Component): """The Bcfg2 Server component providing XML-RPC access to Bcfg methods""" __name__ = 'bcfg2' __implementation__ = 'bcfg2' - fork_funcs = ['GetConfig', 'GetProbes', 'RecvStats'] + fork_funcs = ['GetConfig', 'GetProbes'] request_queue_size = 15 @@ -162,32 +162,16 @@ class Bcfg2Serv(Bcfg2.Component.Component): '''Act on statistics upload''' sdata = XML(stats) state = sdata.find(".//Statistics") - client = self.Core.metadata.resolve_client(address) - meta = self.Core.metadata.get_metadata(client) - - for i in [1, 2, 3]: - # Versioned stats to prevent tied client/server upgrade - if state.get('version') >= '2.0': - root = Element('ConfigStatistics') - stats = Element('Node', name=meta.hostname) - stats.append(state) - state.set('time', time.asctime(time.localtime())) - root.append(stats) - filename = "%s/etc/stats-data-%s-%s.xml" % \ - (self.Core.datastore, meta.hostname, time.time()) - try: - fd = os.open(filename, os.O_CREAT|os.O_EXCL|os.O_RDWR) - except IOError: - if i == 3: - self.logger.error("Failed to write statistics file %s" \ - % filename) - continue - data = os.fdopen(fd, 'w') - data.write(tostring(root)) - data.close() - break - self.logger.info("Client %s reported state %s" % - (client, state.get('state'))) + # Versioned stats to prevent tied client/server upgrade + if state.get('version') >= '2.0': + client = self.Core.metadata.resolve_client(address) + meta = self.Core.metadata.get_metadata(client) + + # Update statistics + self.Core.stats.updateStats(sdata, meta.hostname) + + self.logger.info("Client %s reported state %s" % + (client, state.attrib['state'])) return "" def _authenticate_connection(self, _, user, password, address): -- cgit v1.2.3-1-g7c22