diff options
author | Narayan Desai <desai@mcs.anl.gov> | 2008-02-13 02:22:15 +0000 |
---|---|---|
committer | Narayan Desai <desai@mcs.anl.gov> | 2008-02-13 02:22:15 +0000 |
commit | cd2e6e27203f3c61ad421afd5ea85b3603611bd3 (patch) | |
tree | 8fa77d81b9b20eeaad5966bf4fc0ec11916ad837 | |
parent | 3e7e1a8001c831104561e2a2de1fd702d6590a43 (diff) | |
download | bcfg2-cd2e6e27203f3c61ad421afd5ea85b3603611bd3.tar.gz bcfg2-cd2e6e27203f3c61ad421afd5ea85b3603611bd3.tar.bz2 bcfg2-cd2e6e27203f3c61ad421afd5ea85b3603611bd3.zip |
Fix tb in __important__ path (reported/patched by SolJ) [bugfix]
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@4376 ce84e21b-d406-0410-9b95-82705330c041
-rw-r--r-- | src/lib/Client/Frame.py | 2 | ||||
-rwxr-xr-x | src/sbin/bcfg2-server | 40 |
2 files changed, 29 insertions, 13 deletions
diff --git a/src/lib/Client/Frame.py b/src/lib/Client/Frame.py index a164e9d2e..6d761317d 100644 --- a/src/lib/Client/Frame.py +++ b/src/lib/Client/Frame.py @@ -85,7 +85,7 @@ class Frame: if tl: if not tl[0].VerifyConfigFile(cfile, []): try: - self.states[cfile] = tool.InstallConfigFile(cfile) + self.states[cfile] = tl[0].InstallConfigFile(cfile) except: self.logger.error("Unexpected tool failure", exc_info=1) diff --git a/src/sbin/bcfg2-server b/src/sbin/bcfg2-server index cb27e9c89..f5128e7fd 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, signal, socket, sys +import logging, os, select, signal, socket, sys, time 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'] + fork_funcs = ['GetConfig', 'GetProbes', 'RecvStats'] request_queue_size = 15 @@ -162,16 +162,32 @@ class Bcfg2Serv(Bcfg2.Component.Component): '''Act on statistics upload''' sdata = XML(stats) state = sdata.find(".//Statistics") - # 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'])) + 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'))) return "<ok/>" def _authenticate_connection(self, _, user, password, address): |