if 'release' in createopts and createopts['release']:
self.name += '-' + createopts['release']
- # pending FEA: save log by default for --release
-
if self.pack_to:
if '@NAME@' in self.pack_to:
self.pack_to = self.pack_to.replace('@NAME@', self.name)
wf.write(fr.read().replace("@BUILD_ID@", release))
outimages.append(new_kspath)
+ # save log file, logfile is only available in creator attrs
+ if hasattr(self, 'logfile') and not self.logfile:
+ log_path = _rpath(self.name + ".log")
+ # touch the log file, else outimages will filter it out
+ with open(log_path, 'w') as wf:
+ wf.write('')
+ msger.set_logfile(log_path)
+ outimages.append(_rpath(self.name + ".log"))
+
# rename iso and usbimg
for f in os.listdir(destdir):
if f.endswith(".iso"):
errormsg = os.read(CATCHERR_BUFFILE_FD, size)
os.ftruncate(CATCHERR_BUFFILE_FD, 0)
- if LOG_FILE_FP:
- if errormsg:
- LOG_CONTENT += errormsg
-
- save_msg = msg.strip() if msg else None
- if save_msg:
- global HOST_TIMEZONE
- timestr = time.strftime("[%m/%d %H:%M:%S] ",
- time.gmtime(time.time() - HOST_TIMEZONE))
- LOG_CONTENT += timestr + save_msg + '\n'
+ # append error msg to LOG
+ if errormsg:
+ LOG_CONTENT += errormsg
+
+ # append normal msg to LOG
+ save_msg = msg.strip() if msg else None
+ if save_msg:
+ global HOST_TIMEZONE
+ timestr = time.strftime("[%m/%d %H:%M:%S] ",
+ time.gmtime(time.time() - HOST_TIMEZONE))
+ LOG_CONTENT += timestr + save_msg + '\n'
if errormsg:
_color_print('', NO_COLOR, errormsg, stream, level)