summaryrefslogtreecommitdiffstats
path: root/src/sbin
diff options
context:
space:
mode:
authorJoey Hagedorn <hagedorn@mcs.anl.gov>2005-06-22 22:03:59 +0000
committerJoey Hagedorn <hagedorn@mcs.anl.gov>2005-06-22 22:03:59 +0000
commit856f77b4601b136f816df6acca05cd0c281d1636 (patch)
treeb23d4756569a8d034559010044a800980bdf09e7 /src/sbin
parent8f932afc9865c0276c62166ca14290f99b4c489d (diff)
downloadbcfg2-856f77b4601b136f816df6acca05cd0c281d1636.tar.gz
bcfg2-856f77b4601b136f816df6acca05cd0c281d1636.tar.bz2
bcfg2-856f77b4601b136f816df6acca05cd0c281d1636.zip
added command line options to specify alternate config and statistics files
(Logical change 1.238) git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@995 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/sbin')
-rw-r--r--src/sbin/StatReports.py21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/sbin/StatReports.py b/src/sbin/StatReports.py
index 72aa57730..49fdf4b4e 100644
--- a/src/sbin/StatReports.py
+++ b/src/sbin/StatReports.py
@@ -221,12 +221,23 @@ def www(reportsections,delivery,deliverytype):
if __name__ == '__main__':
c = ConfigParser()
c.read(['/etc/bcfg2.conf'])
- statpath = "%s/statistics.xml" % c.get('server', 'metadata')#this needs
- #to be configurable-- like options like, in case you want to read in a different file
+ configpath = "%s/report-configuration.xml" % c.get('server', 'metadata')
+ statpath = "%s/statistics.xml" % c.get('server', 'metadata')
+ try:
+ opts, args = getopt(argv[1:], "hc:s:", ["help", "config=", "stats="])
+ except GetoptError,msg:
+ # print help information and exit:
+ print "%s\nUsage:\nStatReports.py [-h] [-c <configuration-file>] [-s <statistics-file>]"%(msg)
+ exit(2)
+ for o, a in opts:
+ if o in ("-h", "--help"):
+ print "Usage:\nStatReports.py [-h] [-c <configuration-file>] [-s <statistics-file>]"
+ exit()
+ if o in ("-c", "--config"):
+ configpath = a
+ if o in ("-s", "--stats"):
+ statpath = a
- #configpath = "%s/machine-owners.xml" % c.get('server', 'metadata')
- configpath = "/sandbox/hagedorn/report-configuration.xml"
- '''Reads current state regarding statistics'''
try:
statdata = XML(open(statpath).read())
except (IOError, ExpatError):