From bd51450b465aac81203868e7d1625f1dc0448e07 Mon Sep 17 00:00:00 2001 From: Mike McLean Date: Feb 11 2025 15:38:42 +0000 Subject: [PATCH 1/2] ensure repos dir Fixes https://pagure.io/koji/issue/4315 --- diff --git a/kojihub/kojihub.py b/kojihub/kojihub.py index d645e71..df4bef1 100644 --- a/kojihub/kojihub.py +++ b/kojihub/kojihub.py @@ -13586,8 +13586,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 adedbe6..3ba2b3f 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 From daa26c6de368f780c90d3a106c5f95de0acd3eb7 Mon Sep 17 00:00:00 2001 From: Mike McLean Date: May 14 2025 14:17:44 +0000 Subject: [PATCH 2/2] fix unit test --- diff --git a/tests/test_hub/test_repo_requests.py b/tests/test_hub/test_repo_requests.py index fabea53..8beecb1 100644 --- a/tests/test_hub/test_repo_requests.py +++ b/tests/test_hub/test_repo_requests.py @@ -580,6 +580,10 @@ class TestSymlink(BaseTest): class TestQueueTask(BaseTest): + def setUp(self): + super(TestQueueTask, self).setUp() + self.ensuredir = mock.patch('koji.ensuredir').start() + def test_queue_task(self): req = {'id': 100, 'tag_id': 42, 'tag_name': 'tag 100', 'min_event': None, 'at_event': None, 'opts': None}