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)
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)
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,
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):