diff options
author | Joey Hagedorn <hagedorn@mcs.anl.gov> | 2005-08-10 21:52:14 +0000 |
---|---|---|
committer | Joey Hagedorn <hagedorn@mcs.anl.gov> | 2005-08-10 21:52:14 +0000 |
commit | b9400e3fe2354577ca5575600e56f6582080c1a1 (patch) | |
tree | f17de20c5432cffcd8d7ba84a0dbb086f96108d5 /src/sbin/StatReports | |
parent | 5c3bf07afded2ea22906ca84e178731a4d48a1c2 (diff) | |
download | bcfg2-b9400e3fe2354577ca5575600e56f6582080c1a1.tar.gz bcfg2-b9400e3fe2354577ca5575600e56f6582080c1a1.tar.bz2 bcfg2-b9400e3fe2354577ca5575600e56f6582080c1a1.zip |
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
Diffstat (limited to 'src/sbin/StatReports')
-rw-r--r-- | src/sbin/StatReports | 8 |
1 files changed, 5 insertions, 3 deletions
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') |