From a583f510eb0a96401b1b391f9cdcd748e19fd2d9 Mon Sep 17 00:00:00 2001 From: Joey Hagedorn Date: Wed, 23 Aug 2006 05:46:08 +0000 Subject: 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 --- src/sbin/StatReports | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) (limited to 'src') 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': -- cgit v1.2.3-1-g7c22