Hi, I have tested your patch but it seems that it's still not completely
fixing the issue.
The directories are created correctly (1 per recipe) however the content
is wrong. E.g. I have two recipes, bond-mode0-scenario1 and
bond-mode0-scenario2, at the end of test run bond-mode0-scenario1/info
contains the result of both recipes. And the file
bond-mode0-scenario2/info contains only messages from one of the slaves.
-Jan
Thu, Nov 22, 2012 at 04:09:42PM CET, olichtne(a)redhat.com wrote:
From: Ondrej Lichtner <olichtne(a)redhat.com>
Somwhere during the changes to the logging I created a bug that makes it
that multiple recipes are logged into incorrect directories, getting
further into the folder hierarchy. This patch fixes that by saving the
paths and then restoring them when moving on to the next recipe.
The bug was created by moving code from the LoggingServer to the
NetTestController. The LoggingServer had one static variable as the base
for the paths, however after moving it to the controller the variable is
no longer static and is changed by every slave we are connecting to.
This results in the next recipe being logged in the directory for the
last connected slave of the previous recipe.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
lnst-ctl | 2 ++
lnst/Common/Logs.py | 10 ++++++++++
2 files changed, 12 insertions(+)
diff --git a/lnst-ctl b/lnst-ctl
index 2ce304f..89fadec 100755
--- a/lnst-ctl
+++ b/lnst-ctl
@@ -140,7 +140,9 @@ def main():
summary = []
res_serializer = NetTestResultSerializer()
+ Logs.save_state()
for recipe_path in args:
+ Logs.reset_state()
if os.path.isdir(recipe_path):
all_files = []
for root, dirs, files in os.walk(recipe_path):
diff --git a/lnst/Common/Logs.py b/lnst/Common/Logs.py
index a9910eb..5156af3 100644
--- a/lnst/Common/Logs.py
+++ b/lnst/Common/Logs.py
@@ -156,6 +156,7 @@ class Logs:
debug = None
date = None
nameExtend = None
+ state = None
@classmethod
def __init__(cls,debug=0, waitForNet=False, logger=logging.getLogger(),
recipe_path=None, to_display=True, date=None,
@@ -186,6 +187,15 @@ class Logs:
recipe_path, to_display)
@classmethod
+ def save_state(cls):
+ cls.state = {"logFolder": cls.logFolder, "date": cls.date}
+
+ @classmethod
+ def reset_state(cls):
+ cls.logFolder = cls.state["logFolder"]
+ cls.date = cls.state["date"]
+
+ @classmethod
def clean_root_log_folder(cls, logRootPath):
try:
shutil.rmtree(logRootPath)
--
1.7.11.7
_______________________________________________
LNST-developers mailing list
LNST-developers(a)lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/lnst-developers