#4316 ensure repos dir
Merged a month ago by tkopecek. Opened 4 months ago by mikem.
mikem/koji ensure-repos-1  into  master

file modified
+6
@@ -13586,8 +13586,14 @@ 

              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

file modified
+6
@@ -8,6 +8,7 @@ 

  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 @@ 

      # 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 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}

Metadata Update from @tkopecek:
- Pull-request tagged with: testing-ready

4 months ago

Metadata Update from @tkopecek:
- Pull-request untagged with: testing-ready
- Pull-request tagged with: testing-basic

3 months ago

Metadata Update from @mfilip:
- Pull-request tagged with: testing-done

2 months ago

failing unit test tests/test_hub/test_repo_requests.py

failing unit test tests/test_hub/test_repo_requests.py

doesn't fail here? (F41)

What's the error?

It is trying to create /mnt/koji (so, at least ensuredir is not mockedin TestQueueTask). Maybe this path already exists on your machine?

1 new commit added

  • fix unit test
a month ago

Commit e17671c fixes this pull-request

Pull-Request has been merged by tkopecek

a month ago