summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTim Laszlo <tim.laszlo@gmail.com>2010-05-26 18:23:14 +0000
committerSol Jerome <solj@ices.utexas.edu>2010-05-26 15:37:25 -0500
commit9b7f4f6d50aae3a0d27c2b63e7281d6b7cfcc5d2 (patch)
tree5ade7dccae4681077666169eb24d2a44520d338a /src
parent818a8e6e9c0f8e94fdc284341663518287efb530 (diff)
downloadbcfg2-9b7f4f6d50aae3a0d27c2b63e7281d6b7cfcc5d2.tar.gz
bcfg2-9b7f4f6d50aae3a0d27c2b63e7281d6b7cfcc5d2.tar.bz2
bcfg2-9b7f4f6d50aae3a0d27c2b63e7281d6b7cfcc5d2.zip
Add option to log importscript.py messages to syslog
Since we need the ability to do this for DBStats.py it doesn't hurt to add this if importscript.py runs with statistics.xml data. git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5868 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src')
-rwxr-xr-xsrc/lib/Server/Reports/importscript.py22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/lib/Server/Reports/importscript.py b/src/lib/Server/Reports/importscript.py
index 8b0b5b144..017bfd470 100755
--- a/src/lib/Server/Reports/importscript.py
+++ b/src/lib/Server/Reports/importscript.py
@@ -218,22 +218,17 @@ if __name__ == '__main__':
cpath = "/etc/bcfg2.conf"
clientpath = False
statpath = False
+ syslog = False
try:
- opts, args = getopt(argv[1:], "hvudc:s:C", ["help", "verbose", "updates" ,
+ opts, args = getopt(argv[1:], "hvudc:s:CS", ["help", "verbose", "updates" ,
"debug", "clients=", "stats=",
- "config="])
+ "config=", "syslog"])
except GetoptError, mesg:
# print help information and exit:
- print "%s\nUsage:\nimportscript.py [-h] [-v] [-u] [-d] [-C bcfg2 config file] [-c clients-file] [-s statistics-file]" % (mesg)
+ print "%s\nUsage:\nimportscript.py [-h] [-v] [-u] [-d] [-S] [-C bcfg2 config file] [-c clients-file] [-s statistics-file]" % (mesg)
raise SystemExit, 2
- logger = logging.getLogger('importscript.py')
- logging.getLogger().setLevel(logging.INFO)
- Bcfg2.Logger.setup_logging('importscript.py',
- True,
- False)
-
for o, a in opts:
if o in ("-h", "--help"):
print "Usage:\nimportscript.py [-h] [-v] -c <clients-file> -s <statistics-file> \n"
@@ -244,6 +239,7 @@ if __name__ == '__main__':
print "C : path to bcfg2.conf config file."
print "c : clients.xml file"
print "s : statistics.xml file"
+ print "S : syslog; output to syslog"
raise SystemExit
if o in ["-C", "--config"]:
cpath = a
@@ -259,6 +255,14 @@ if __name__ == '__main__':
if o in ("-s", "--stats"):
statpath = a
+ if o in ("-S", "--syslog"):
+ syslog = True
+
+ logger = logging.getLogger('importscript.py')
+ logging.getLogger().setLevel(logging.INFO)
+ Bcfg2.Logger.setup_logging('importscript.py',
+ True,
+ syslog)
cf = ConfigParser.ConfigParser()
cf.read([cpath])