PR#4037: Fix temporary cg_import.log file path
Merges #4037 https://pagure.io/koji/pull-request/4037 Fixes: #4036 https://pagure.io/koji/issue/4036 cg import uses wrong log path
This commit is contained in:
commit
3d6b10905e
1 changed files with 4 additions and 3 deletions
|
|
@ -7012,10 +7012,11 @@ class CG_Importer(object):
|
|||
|
||||
def log(self, msg, level=logging.WARNING):
|
||||
if self._cg_log_file is None:
|
||||
log_dir = joinpath(koji.pathinfo.work(), 'logs')
|
||||
log_dir = joinpath(koji.pathinfo.work(), 'cg_import_logs')
|
||||
koji.ensuredir(log_dir)
|
||||
self._cg_log_path = joinpath(log_dir, 'cg_import.log')
|
||||
self._cg_log_file = open(self._cg_log_path, mode='wt')
|
||||
fd, fpath = tempfile.mkstemp(dir=log_dir, suffix="-cg_import.log", text=True)
|
||||
self._cg_log_path = fpath
|
||||
self._cg_log_file = os.fdopen(fd, 'wt')
|
||||
logger.log(level=level, msg=msg)
|
||||
self._cg_log_file.write(msg + '\n')
|
||||
self._cg_log_file.flush()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue