diff options
author | Joey Hagedorn <hagedorn@mcs.anl.gov> | 2005-08-03 03:59:39 +0000 |
---|---|---|
committer | Joey Hagedorn <hagedorn@mcs.anl.gov> | 2005-08-03 03:59:39 +0000 |
commit | 23b4fb9afd8ef02feb27b075326c1fbc8393286a (patch) | |
tree | 47d9f649c18f637bcd51f147627a0a6282a20bca | |
parent | 0b8bde311966a9a5151922ae55298f0ca95c1edc (diff) | |
download | bcfg2-23b4fb9afd8ef02feb27b075326c1fbc8393286a.tar.gz bcfg2-23b4fb9afd8ef02feb27b075326c1fbc8393286a.tar.bz2 bcfg2-23b4fb9afd8ef02feb27b075326c1fbc8393286a.zip |
UGLY workaround for a problem when xsltransform yields a blank document, removal of extra code for speedup(extra copying of datastructure)
(Logical change 1.279)
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@1125 ce84e21b-d406-0410-9b95-82705330c041
-rw-r--r-- | src/sbin/StatReports | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/sbin/StatReports b/src/sbin/StatReports index 7e9f70faa..cf7f8d711 100644 --- a/src/sbin/StatReports +++ b/src/sbin/StatReports @@ -113,7 +113,7 @@ def rss(reportxml, delivery, report): chantitle.text = report.attrib['name'] chanlink = SubElement(channel, "link") - #this can later link to WWW report if one gets published simultaneously + #this can later link to WWW report if one gets published simultaneously? chanlink.text = "http://www.mcs.anl.gov/cobalt/bcfg2" chandesc = SubElement(channel, "description") chandesc.text = "Information regarding the 10 most recent bcfg2 runs." @@ -130,8 +130,8 @@ def rss(reportxml, delivery, report): def www(reportxml, delivery, report): '''www outputs report to''' - - #check and see if rss file xists--to link to? + + #this can later link to WWW report if one gets published simultaneously? for destination in delivery.findall('Destination'): fil = open(destination.attrib['address'], 'w') @@ -235,17 +235,15 @@ if __name__ == '__main__': for reprt in configdata.findall('Report'): nodereport.set("name", reprt.get("name", default="BCFG Report")) - pnodereport = generatereport(reprt, nodereport) + procnodereport = generatereport(reprt, nodereport) for deliv in reprt.findall('Delivery'): - procnodereport = deepcopy(pnodereport)#this might not need to be a deep copy - + #is a deepcopy of procnodereport necessary? + delivtype = deliv.get('type', default='nodes-digest') deliverymechanism = deliv.get('mechanism', default='invalid') - #apply XSLT, different ones based on report type, and options - transform = '' if deliverymechanism == 'mail': if delivtype == 'nodes-individual': @@ -291,7 +289,12 @@ if __name__ == '__main__': tempr.close() del tempr result = style.applyStylesheet(doc, None) - outputstring = style.saveResultToString(result) + try: + outputstring = style.saveResultToString(result) + except: + outputstring = None#this is a nasty hack. When the xslt transform breaks-- just blank it out + #this is done due to a bug in libxslt + #This needs to be fixed in future releases if not outputstring == None: toastring = '' for desti in deliv.findall("Destination"): |