summaryrefslogtreecommitdiffstats
path: root/src/sbin/StatReports
diff options
context:
space:
mode:
authorJoey Hagedorn <hagedorn@mcs.anl.gov>2005-12-19 22:54:25 +0000
committerJoey Hagedorn <hagedorn@mcs.anl.gov>2005-12-19 22:54:25 +0000
commitd4469be76426ccedba2bdd591ee38b5742266a21 (patch)
tree7b782ccd047d30a654541736aae6f8cb00cd4a73 /src/sbin/StatReports
parent5b7caaeb85b8600550d49cc51ce556c61e88ac2f (diff)
downloadbcfg2-d4469be76426ccedba2bdd591ee38b5742266a21.tar.gz
bcfg2-d4469be76426ccedba2bdd591ee38b5742266a21.tar.bz2
bcfg2-d4469be76426ccedba2bdd591ee38b5742266a21.zip
Modified StatReports to implement new naming convention for xsl-transforms and reports.
Xsl files can be arbitrarily added by user as long as they adhere to naming convention: <delivery-type>-<delivery mechanism>.xsl git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@1631 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/sbin/StatReports')
-rw-r--r--src/sbin/StatReports32
1 files changed, 8 insertions, 24 deletions
diff --git a/src/sbin/StatReports b/src/sbin/StatReports
index c0321d23c..fd26d703f 100644
--- a/src/sbin/StatReports
+++ b/src/sbin/StatReports
@@ -233,34 +233,18 @@ if __name__ == '__main__':
#is a deepcopy of procnodereport necessary?
delivtype = deliv.get('type', default='nodes-digest')
- deliverymechanism = deliv.get('mechanism', default='invalid')
+ deliverymechanism = deliv.get('mechanism', default='www')
#apply XSLT, different ones based on report type, and options
- transform = ''
- if deliverymechanism == 'mail':
- if delivtype == 'nodes-individual':
- transform = 'nodes-individual-email.xsl'
- elif delivtype == 'overview-stats':
- transform = 'overview-stats-email.xsl'
- else:
- transform = 'nodes-digest-email.xsl'
- elif deliverymechanism == 'rss':
- if delivtype == 'overview-stats':
- transform = 'overview-stats-rss.xsl'
- else:
- transform = 'nodes-digest-rss.xsl'
- elif deliverymechanism == 'www':
- if delivtype == 'overview-stats':
- transform = 'overview-stats-html.xsl'
- elif delivtype == 'times':
- transform = 'timing-perf-html.xsl'
- else:
- transform = 'nodes-digest-html.xsl'
- elif deliverymechanism == 'null-operator':
+ if deliverymechanism == 'null-operator':
fileout(tostring(ElementTree(procnodereport).getroot()),deliv)
break
- else:
- print("StatReports: Invalid delivery mechanism in report-config")
+ transform = delivtype + '-' + deliverymechanism + '.xsl'
+ try:
+ os.stat(transformpath + transform)
+ except:
+ print("StatReports: Invalid report type or delivery mechanism.\n Can't find: "\
+ + transformpath + transform)
raise SystemExit, 1
try: