in newRepo too

This commit is contained in:
Mike McLean 2024-02-02 13:19:36 -05:00 committed by Tomas Kopecek
parent 56d861bff3
commit e169a6bf3e

View file

@ -5725,6 +5725,15 @@ class NewRepoTask(BaseTaskHandler):
def handler(self, tag, event=None, src=False, debuginfo=False, separate_src=False):
tinfo = self.session.getTag(tag, strict=True, event=event)
# check for fs access before we try calling repoInit
top_repos_dir = joinpath(self.options.topdir, "repos")
if not os.path.isdir(top_repos_dir):
# missing or incorrect mount?
# refuse and let another host try
self.session.refuseTask(self.id, msg="No access to repos dir %s" % top_repos_dir)
# call repoInit
kwargs = {}
if event is not None:
kwargs['event'] = event
@ -5736,6 +5745,7 @@ class NewRepoTask(BaseTaskHandler):
if debuginfo or tinfo['extra'].get('with_debuginfo'):
kwargs['with_debuginfo'] = True
repo_id, event_id = self.session.host.repoInit(tinfo['id'], task_id=self.id, **kwargs)
path = koji.pathinfo.repo(repo_id, tinfo['name'])
if not os.path.isdir(path):
raise koji.GenericError("Repo directory missing: %s" % path)