From 0bf6a9dbf59f95557263ae5cafea0b2a9dcf176d Mon Sep 17 00:00:00 2001 From: Szilard Cserey Date: Thu, 29 Oct 2015 10:22:18 +0100 Subject: [PATCH] minor fixes fix for error log collecting feature Change-Id: I4db2ac19421301e1745a3beed90f32df57d75f8d Signed-off-by: Szilard Cserey --- fuel/deploy/cloud/deployment.py | 4 ++-- fuel/deploy/common.py | 7 +++++-- fuel/deploy/install_fuel_master.py | 1 - 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/fuel/deploy/cloud/deployment.py b/fuel/deploy/cloud/deployment.py index defe5eb64..a294be545 100644 --- a/fuel/deploy/cloud/deployment.py +++ b/fuel/deploy/cloud/deployment.py @@ -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) diff --git a/fuel/deploy/common.py b/fuel/deploy/common.py index cdc54b43a..17fd2174a 100644 --- a/fuel/deploy/common.py +++ b/fuel/deploy/common.py @@ -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, diff --git a/fuel/deploy/install_fuel_master.py b/fuel/deploy/install_fuel_master.py index 1b82483eb..e3a7327c0 100644 --- a/fuel/deploy/install_fuel_master.py +++ b/fuel/deploy/install_fuel_master.py @@ -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): -- 2.16.6