From b9400e3fe2354577ca5575600e56f6582080c1a1 Mon Sep 17 00:00:00 2001 From: Joey Hagedorn Date: Wed, 10 Aug 2005 21:52:14 +0000 Subject: added error checking with getsendmailpath (Logical change 1.287) git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@1146 ce84e21b-d406-0410-9b95-82705330c041 --- src/sbin/StatReports | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/sbin/StatReports') diff --git a/src/sbin/StatReports b/src/sbin/StatReports index e564af627..91321919d 100644 --- a/src/sbin/StatReports +++ b/src/sbin/StatReports @@ -7,7 +7,7 @@ for bcfg2''' __revision__ = '$Revision$' -from ConfigParser import ConfigParser +from ConfigParser import ConfigParser, NoSectionError, NoOptionError from elementtree.ElementTree import * from xml.parsers.expat import ExpatError from xml.sax.saxutils import escape @@ -81,8 +81,10 @@ def generatereport(rs, nr): def mail(mailbody, confi): '''mail mails a previously generated report''' - mailer = confi.get('statistics', 'sendmailpath') - + try: + mailer = confi.get('statistics', 'sendmailpath') + except NoSectionError, NoOptionError: + mailer = "/usr/sbin/sendmail" # open a pipe to the mail program and # write the data to the pipe pipe = os.popen("%s -t" % mailer, 'w') -- cgit v1.2.3-1-g7c22