Bugfix: can not find tempest.log 07/14807/4
authorSerenaFeng <feng.xiaowei@zte.com.cn>
Sat, 28 May 2016 14:18:45 +0000 (22:18 +0800)
committerjose.lausuch <jose.lausuch@ericsson.com>
Mon, 30 May 2016 11:47:37 +0000 (13:47 +0200)
JIRA: FUNCTEST-269

Remove dependency on CI_DEBUG and use subprocess.call to
redirect stdout to tempest.log in any case.

Change-Id: Ibac68bec7f98007d24def25fd609051b5c528fc7
Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
testcases/OpenStack/tempest/run_tempest.py

index 93581f0..f773321 100644 (file)
@@ -256,30 +256,27 @@ def run_tempest(OPTION):
     cmd_line = "rally verify start " + OPTION + " --system-wide"
     CI_DEBUG = os.environ.get("CI_DEBUG")
 
-    if CI_DEBUG == "true" or CI_DEBUG == "True":
-        ft_utils.execute_command(cmd_line, logger, exit_on_error=True)
-    else:
-        header = ("Tempest environment:\n"
-                  "  Installer: %s\n  Scenario: %s\n  Node: %s\n  Date: %s\n" %
-                  (os.getenv('INSTALLER_TYPE', 'Unknown'),
-                   os.getenv('DEPLOY_SCENARIO', 'Unknown'),
-                   os.getenv('NODE_NAME', 'Unknown'),
-                   time.strftime("%a %b %d %H:%M:%S %Z %Y")))
-
-        f_stdout = open(TEMPEST_RESULTS_DIR + "/tempest.log", 'w+')
-        f_stderr = open(TEMPEST_RESULTS_DIR + "/tempest-error.log", 'w+')
-        f_env = open(TEMPEST_RESULTS_DIR + "/environment.log", 'w+')
-        f_env.write(header)
-
-        subprocess.call(cmd_line, shell=True, stdout=f_stdout, stderr=f_stderr)
-
-        f_stdout.close()
-        f_stderr.close()
-        f_env.close()
-
-        cmd_line = "rally verify show"
-        ft_utils.execute_command(cmd_line, logger,
-                                 exit_on_error=True, info=True)
+    header = ("Tempest environment:\n"
+              "  Installer: %s\n  Scenario: %s\n  Node: %s\n  Date: %s\n" %
+              (os.getenv('INSTALLER_TYPE', 'Unknown'),
+               os.getenv('DEPLOY_SCENARIO', 'Unknown'),
+               os.getenv('NODE_NAME', 'Unknown'),
+               time.strftime("%a %b %d %H:%M:%S %Z %Y")))
+
+    f_stdout = open(TEMPEST_RESULTS_DIR + "/tempest.log", 'w+')
+    f_stderr = open(TEMPEST_RESULTS_DIR + "/tempest-error.log", 'w+')
+    f_env = open(TEMPEST_RESULTS_DIR + "/environment.log", 'w+')
+    f_env.write(header)
+
+    subprocess.call(cmd_line, shell=True, stdout=f_stdout, stderr=f_stderr)
+
+    f_stdout.close()
+    f_stderr.close()
+    f_env.close()
+
+    cmd_line = "rally verify show"
+    ft_utils.execute_command(cmd_line, logger,
+                             exit_on_error=True, info=True)
 
     cmd_line = "rally verify list"
     logger.debug('Executing command : {}'.format(cmd_line))