From f14cde00dfa0b251992ecd94269b2b40410d720c Mon Sep 17 00:00:00 2001
From: Pieter Donker <donker@astron.nl>
Date: Wed, 19 Dec 2012 08:14:13 +0000
Subject: [PATCH] Task #3805: Changed log dir.

---
 LCU/checkhardware/checkHardware.conf    |  4 ++--
 LCU/checkhardware/doFullStationTest.sh  |  2 +-
 LCU/checkhardware/doShortStationTest.sh |  2 +-
 LCU/checkhardware/lib/general_lib.py    |  6 +++---
 LCU/checkhardware/makeStationLogFile.py | 10 ++++++++--
 LCU/checkhardware/showTestResult.py     |  9 +++++++--
 6 files changed, 22 insertions(+), 11 deletions(-)

diff --git a/LCU/checkhardware/checkHardware.conf b/LCU/checkhardware/checkHardware.conf
index c4c97a92246..0c53a7c5017 100644
--- a/LCU/checkhardware/checkHardware.conf
+++ b/LCU/checkhardware/checkHardware.conf
@@ -3,7 +3,7 @@
 # tests to do in given levels, level-0 = empty, test can be given as arguments
 level-0-tests=
 level-1-tests=S1,N1,S3,N3,S5,N5,M
-level-2-tests=RV,TV,TM,S1,S3,S5,N1,N3,N5,M
+level-2-tests=RV,TV,TM,S1,S3,S5,N1,N3,N5,NE,M
 level-3-tests=S1,S3
 
 # TBB versions
@@ -30,5 +30,5 @@ hba-min-deviation=-24
 hba-max-deviation=12
 
 # General settings
-log-dir=/opt/checkhardware/log
+log-dir=/globalhome/log
 
diff --git a/LCU/checkhardware/doFullStationTest.sh b/LCU/checkhardware/doFullStationTest.sh
index c998f148a2b..2d6275405c4 100755
--- a/LCU/checkhardware/doFullStationTest.sh
+++ b/LCU/checkhardware/doFullStationTest.sh
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-logdir="/opt/checkhardware/log/"
+logdir="/globalhome/log/"
 
 host=`hostname -s`
 filenameFrom=$logdir$host"_StationTest.csv"
diff --git a/LCU/checkhardware/doShortStationTest.sh b/LCU/checkhardware/doShortStationTest.sh
index 5639338de04..75cf1d29af7 100755
--- a/LCU/checkhardware/doShortStationTest.sh
+++ b/LCU/checkhardware/doShortStationTest.sh
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-logdir="/opt/checkhardware/log/"
+logdir="/globalhome/log/"
 
 host=`hostname -s`
 filenameFrom=$logdir$host"_StationTest.csv"
diff --git a/LCU/checkhardware/lib/general_lib.py b/LCU/checkhardware/lib/general_lib.py
index cdaa97a26a7..e4079296aaa 100644
--- a/LCU/checkhardware/lib/general_lib.py
+++ b/LCU/checkhardware/lib/general_lib.py
@@ -89,10 +89,10 @@ class cStationLogger(cLogger):
     def __init__(self, logdir):
         filename = "stationtest_" + getHostName() + '.log'        
         cLogger.__init__(self, logdir, filename)
-        cLogger.info(self, "#StID  >: %s" %(getHostName()))
-        cLogger.info(self, "#Lgfl  >: %s" %(logdir+filename))
+        cLogger.info(self, "StID  >: %s" %(getHostName()))
+        cLogger.info(self, "Lgfl  >: %s" %(os.path.join(logdir,filename)))
         testdate = time.strftime("%a, %d %b %Y %H:%M:%S", time.localtime())
-        cLogger.info(self, "#Time  >: %s" %(testdate))
+        cLogger.info(self, "Time  >: %s" %(testdate))
     
     def addLine(self, info):
         cLogger.info(self, info) 
diff --git a/LCU/checkhardware/makeStationLogFile.py b/LCU/checkhardware/makeStationLogFile.py
index 29eb61dcb64..0158d801202 100755
--- a/LCU/checkhardware/makeStationLogFile.py
+++ b/LCU/checkhardware/makeStationLogFile.py
@@ -12,11 +12,17 @@ sys.path.insert(0, libPath)
 
 from general_lib import *
 
-logdir = '/opt/checkhardware/log/'
+f = open("checkHardware.conf", 'r')
+data = f.readlines()
+f.close()
+for line in data:
+    if line.find('log-dir') != -1:
+        key, logdir = line.strip().split('=')
+
 log = cStationLogger(logdir)
 
 testfilename = '%s_StationTest.csv' %(getHostName())
-fullFilename = logdir + testfilename
+fullFilename = os.path.join(logdir, testfilename)
 f = open(fullFilename, 'r')
 testdata = f.readlines()
 f.close()
diff --git a/LCU/checkhardware/showTestResult.py b/LCU/checkhardware/showTestResult.py
index 2ef3b41ad21..8681604ca83 100755
--- a/LCU/checkhardware/showTestResult.py
+++ b/LCU/checkhardware/showTestResult.py
@@ -42,10 +42,15 @@ StID = args.get('s', getHostName())
 
 
 def main():
-    logdir = '/opt/checkhardware/log/'
+    f = open("checkHardware.conf", 'r')
+    data = f.readlines()
+    f.close()
+    for line in data:
+        if line.find('log-dir') != -1:
+            key, logdir = line.strip().split('=')
     
     testfilename = '%s_StationTest.csv' %(StID)
-    fullFilename = logdir + testfilename
+    fullFilename = os.path.join(logdir, testfilename)
     f = open(fullFilename, 'r')
     data = f.readlines()
     f.close()
-- 
GitLab