minor fixes 67/3067/1
authorSzilard Cserey <szilard.cserey@ericsson.com>
Thu, 29 Oct 2015 09:22:18 +0000 (10:22 +0100)
committerSzilard Cserey <szilard.cserey@ericsson.com>
Thu, 5 Nov 2015 13:43:08 +0000 (14:43 +0100)
fix for error log collecting feature

Change-Id: I4db2ac19421301e1745a3beed90f32df57d75f8d
Signed-off-by: Szilard Cserey <szilard.cserey@ericsson.com>
fuel/deploy/cloud/deployment.py
fuel/deploy/common.py
fuel/deploy/install_fuel_master.py

index defe5eb..a294be5 100644 (file)
@@ -47,7 +47,7 @@ class Deployment(object):
             results, _ = exec_cmd(cmd, False)
             for result in results.splitlines():
                 log_msg = ''
-                cmd = ('ssh -q node-%s grep -B%s \'"%s"\' %s'
+                cmd = ('ssh -q node-%s "grep -B%s \\"%s\\" %s"'
                        % (node_id, GREP_LINES_OF_LEADING_CONTEXT, result,
                           LOG_FILE))
                 details, _ = exec_cmd(cmd, False)
@@ -61,7 +61,7 @@ class Deployment(object):
                 if found_prev_log:
                     log_msg += '\n'.join(details_list[i:-1]) + '\n'
 
-                cmd = ('ssh -q node-%s grep -A%s \'"%s"\' %s'
+                cmd = ('ssh -q node-%s "grep -A%s \\"%s\\" %s"'
                        % (node_id, GREP_LINES_OF_TRAILING_CONTEXT, result,
                           LOG_FILE))
                 details, _ = exec_cmd(cmd, False)
index cdc54b4..17fd217 100644 (file)
@@ -30,10 +30,13 @@ formatter = logging.Formatter('%(message)s')
 out_handler = logging.StreamHandler(sys.stdout)
 out_handler.setFormatter(formatter)
 LOG.addHandler(out_handler)
-out_handler = logging.FileHandler('autodeploy.log', mode='w')
+LOGFILE = 'autodeploy.log'
+if os.path.isfile(LOGFILE):
+    os.remove(LOGFILE)
+out_handler = logging.FileHandler(LOGFILE, mode='w')
 out_handler.setFormatter(formatter)
 LOG.addHandler(out_handler)
-os.chmod('autodeploy.log', stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO)
+os.chmod(LOGFILE, stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO)
 
 def exec_cmd(cmd, check=True):
     process = subprocess.Popen(cmd,
index 1b82483..e3a7327 100644 (file)
@@ -211,7 +211,6 @@ class InstallFuelMaster(object):
     def post_install_cleanup(self):
         log('Eject ISO file %s' % self.iso_file)
         self.dha.node_eject_iso(self.fuel_node_id)
-        log('Remove ISO directory %s' % self.iso_dir)
         delete(self.iso_dir)
 
     def delete_deprecated_fuel_client_config(self):