PR#4316: ensure repos dir
Merges #4316 https://pagure.io/koji/pull-request/4316 Fixes: #4315 https://pagure.io/koji/issue/4315 In clean installation topdir/repos is not created
This commit is contained in:
commit
e17671c51c
3 changed files with 16 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue