From 7e71f182124aa331a896f42ea9155d388e04618e Mon Sep 17 00:00:00 2001 From: Mike McLean Date: Tue, 11 Feb 2025 10:36:21 -0500 Subject: [PATCH] ensure repos dir Fixes https://pagure.io/koji/issue/4315 --- kojihub/kojihub.py | 6 ++++++ kojihub/repos.py | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/kojihub/kojihub.py b/kojihub/kojihub.py index 24f8eda7..88c6ee4d 100644 --- a/kojihub/kojihub.py +++ b/kojihub/kojihub.py @@ -13605,8 +13605,14 @@ class RootExports(object): pass else: context.session.assertPerm('regen-repo') + # raise error when tag does not exist get_tag(tag, strict=True, event=event) + + # make sure repos dir exists, otherwise hosts will reject task + repos_dir = joinpath(koji.pathinfo.topdir, 'repos') + koji.ensuredir(repos_dir) + opts = {} if event is not None: opts['event'] = event diff --git a/kojihub/repos.py b/kojihub/repos.py index a9ab40a8..ba92d118 100644 --- a/kojihub/repos.py +++ b/kojihub/repos.py @@ -8,6 +8,7 @@ import koji from . import kojihub from koji.context import context +from koji.util import joinpath from kojihub.db import (QueryView, UpdateProcessor, BulkUpdateProcessor, InsertProcessor, nextval, Savepoint, QueryProcessor, db_lock, DeleteProcessor) @@ -376,6 +377,11 @@ def repo_queue_task(req): # TODO should we error if user doesn't exist if user_id: taskopts['owner'] = user_id + + # make sure repos dir exists, otherwise hosts will reject task + repos_dir = joinpath(koji.pathinfo.topdir, 'repos') + koji.ensuredir(repos_dir) + task_id = kojihub.make_task('newRepo', args, **taskopts) return task_id # caller should update request entry if needed