diff options
author | Narayan Desai <desai@mcs.anl.gov> | 2006-06-10 14:02:19 +0000 |
---|---|---|
committer | Narayan Desai <desai@mcs.anl.gov> | 2006-06-10 14:02:19 +0000 |
commit | a56114f22e093d61e7b9948cee858069cefcbf7a (patch) | |
tree | 10c5a2b32faf9026674c429eb3b8fc62d500e965 /src/lib | |
parent | 7fb3fc58674e5ff7fd1310c4839df5ca0004f8db (diff) | |
download | bcfg2-a56114f22e093d61e7b9948cee858069cefcbf7a.tar.gz bcfg2-a56114f22e093d61e7b9948cee858069cefcbf7a.tar.bz2 bcfg2-a56114f22e093d61e7b9948cee858069cefcbf7a.zip |
Patch from Jos for statistics error handling
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@1875 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/Server/Statistics.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lib/Server/Statistics.py b/src/lib/Server/Statistics.py index e13bd805e..555afe052 100644 --- a/src/lib/Server/Statistics.py +++ b/src/lib/Server/Statistics.py @@ -41,12 +41,13 @@ class Statistics(object): #syslog(LOG_INFO, "Statistics: Updated statistics.xml") try: fout = open(self.filename, 'w') + except IOError, ioerr: + self.logger.error("Failed to open %s for writing: %s" % (self.filename, ioerr)) + else: fout.write(self.pretty_print(self.element)) fout.close() self.dirty = 0 self.lastwrite = time() - except IOError: - self.logger.error("Failed to open %s for writing" % (self.filename)) def ReadFromFile(self): '''Reads current state regarding statistics''' |