summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2008-02-13 02:24:23 +0000
committerNarayan Desai <desai@mcs.anl.gov>2008-02-13 02:24:23 +0000
commit18b9808b79bbed11a06b598d259152795111c0d0 (patch)
tree94fe9c534763766c63e4b51f728e66f861f7e5d8 /src
parentcd2e6e27203f3c61ad421afd5ea85b3603611bd3 (diff)
downloadbcfg2-18b9808b79bbed11a06b598d259152795111c0d0.tar.gz
bcfg2-18b9808b79bbed11a06b598d259152795111c0d0.tar.bz2
bcfg2-18b9808b79bbed11a06b598d259152795111c0d0.zip
revert mistaken bcfg2-server commit [bugfix]
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@4377 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src')
-rwxr-xr-xsrc/sbin/bcfg2-server40
1 files 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 "<ok/>"
def _authenticate_connection(self, _, user, password, address):