diff options
author | Joey Hagedorn <hagedorn@mcs.anl.gov> | 2006-08-23 05:46:08 +0000 |
---|---|---|
committer | Joey Hagedorn <hagedorn@mcs.anl.gov> | 2006-08-23 05:46:08 +0000 |
commit | a583f510eb0a96401b1b391f9cdcd748e19fd2d9 (patch) | |
tree | 5b39325811d93210ff8671eb1c6cdc8046fa855d | |
parent | 27869eb6933b0670049f2b6ab3e387cd7a0c7653 (diff) | |
download | bcfg2-a583f510eb0a96401b1b391f9cdcd748e19fd2d9.tar.gz bcfg2-a583f510eb0a96401b1b391f9cdcd748e19fd2d9.tar.bz2 bcfg2-a583f510eb0a96401b1b391f9cdcd748e19fd2d9.zip |
StatReports Bug fix; web and rss reports nolonger are blank when included in multiple-delivery report where mail type is nodes-individual comes before other types in the configuration file.
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@2094 ce84e21b-d406-0410-9b95-82705330c041
-rwxr-xr-x | src/sbin/StatReports | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/src/sbin/StatReports b/src/sbin/StatReports index f5976da63..1192564f9 100755 --- a/src/sbin/StatReports +++ b/src/sbin/StatReports @@ -254,24 +254,37 @@ if __name__ == '__main__': if deliverymechanism == 'mail': if delivtype == 'nodes-individual': reportdata = copy.deepcopy(procnodereport) - for noden in procnodereport.findall("Node"): + for noden in reportdata.findall("Node"): [reportdata.remove(y) for y in reportdata.findall("Node")] reportdata.append(noden) + result = stylesheet.apply(ElementTree(reportdata)) + outputstring = stylesheet.tostring(result) + + if not outputstring == None: + toastring = '' + for desti in deliv.findall("Destination"): + toastring = "%s%s " % \ + (toastring, desti.get('address')) + #prepend To: and From: + outputstring = "To: %s\nFrom: root@%s\n%s"% \ + (toastring, socket.getfqdn(), outputstring) + mail(outputstring, c) #call function to send + else: reportdata = copy.deepcopy(procnodereport) - result = stylesheet.apply(ElementTree(reportdata)) - outputstring = stylesheet.tostring(result) + result = stylesheet.apply(ElementTree(reportdata)) + outputstring = stylesheet.tostring(result) - if not outputstring == None: - toastring = '' - for desti in deliv.findall("Destination"): - toastring = "%s%s " % \ - (toastring, desti.get('address')) - #prepend To: and From: - outputstring = "To: %s\nFrom: root@%s\n%s"% \ - (toastring, socket.getfqdn(), outputstring) - mail(outputstring, c) #call function to send + if not outputstring == None: + toastring = '' + for desti in deliv.findall("Destination"): + toastring = "%s%s " % \ + (toastring, desti.get('address')) + #prepend To: and From: + outputstring = "To: %s\nFrom: root@%s\n%s"% \ + (toastring, socket.getfqdn(), outputstring) + mail(outputstring, c) #call function to send else: outputstring = tostring(stylesheet.apply(ElementTree(procnodereport)).getroot()) if deliverymechanism == 'rss': |