Skip to content

Commit

Permalink
[copr-dist-git] Make sure /var/lib/copr-dist-git/per-task-logs dir ex…
Browse files Browse the repository at this point in the history
…ists in importer_runner.py
  • Loading branch information
clime committed Mar 8, 2016
1 parent 8271155 commit 3628b87
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion dist-git/run/importer_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ def main():
except Exception:
print("Failed to read config file, used file location: `{}`"
.format(config_file))
# sys.exit(1)
sys.exit(1)


logging.basicConfig(
filename=os.path.join(opts.log_dir, "main.log"),
level=logging.DEBUG,
Expand All @@ -36,6 +36,15 @@ def main():
logging.getLogger('requests.packages.urllib3').setLevel(logging.WARN)
logging.getLogger('urllib3').setLevel(logging.WARN)

log.info("Make sure per-task-logs dir exists at: {}".format(opts.per_task_log_dir))
try:
os.makedirs(opts.per_task_log_dir)
except OSError:
if not os.path.isdir(opts.per_task_log_dir):
log.error("Could not create per-task-logs directory at path {}"
.format(opts.per_task_log_dir))
sys.exit(1)

log.info("Logging configuration done")
log.info("Using configuration: \n"
"{}".format(opts))
Expand Down

0 comments on commit 3628b87

Please sign in to comment.