#4190 fetchKickstart could fail with better error in case of non-existent kickstart
Closed: Fixed by tkopecek. Opened by tkopecek.

Task fails but it should be caught before trying to upload non-existent file. It is now more visible due to changes in #4093

Traceback (most recent call last):
  File "/usr/lib/python3.12/site-packages/koji/daemon.py", line 1421, in runTask
    response = (handler.run(),)
                ^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/koji/tasks.py", line 343, in run
    return koji.util.call_with_argcheck(self.handler, self.params, self.opts)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/koji/util.py", line 507, in call_with_argcheck
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/sbin/kojid", line 4709, in handler
    kspath = self.fetchKickstart(build_tag=target_info['build_tag_name'])
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/sbin/kojid", line 4037, in fetchKickstart
    self.uploadFile(kspath)  # upload the original ks file
    ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/koji/tasks.py", line 482, in uploadFile
    self.session.uploadWrapper(filename, uploadPath, remoteName, volume=volume)
  File "/usr/lib/python3.12/site-packages/koji/__init__.py", line 3389, in uploadWrapper
    self.fastUpload(localfile, path, name, callback, blocksize, overwrite, volume=volume)
  File "/usr/lib/python3.12/site-packages/koji/__init__.py", line 3284, in fastUpload
    fo = open(localfile, 'rb')
         ^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/var/tmp/koji/tasks/401/401/fedora-kickstarts/fedora-cloud-base-vagrant.ks-non-exist'

Metadata Update from @jcupova:
- Custom field Size adjusted to None

Do we have an example failure here? I'm not sure this is the only failure mode that might make an ugly error.

There are two fetchKickstart definitions. I'm guessing this is the one from OzImageTask, based on the line number?

Anything with nonexistent kickstart, so both are affected. See e.g. task 66735134 in brew.

See e.g. task 66735134

For reference, this example is a createImage task which includes a git+https:// ksurl option (w/ HEAD as the ref) and a kickstart option with a filename that does not exist in the checkout. The checkout.log file shows a successful checkout, but the task fails with a trace like the one above. The fetchKickstart in the trace is the one from OzImageTask.

So, were the upload error were ignored as before. it looks like the code would go on to fail in readKickstart with koji.BuildError("Failed to read kickstart file '%s' : %s" % (kspath, e))

Metadata Update from @jcupova:
- Issue tagged with: testing-ready

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

Metadata Update from @mfilip:
- Issue tagged with: testing-done

Commit 67974ae7 fixes this issue

Commit dd6b8393 fixes this issue

This issue has been migrated to Fedora Forge:
https://forge.fedoraproject.org/koji/koji/issues/4190

Please continue any further discussion there.

Metadata
Related Pull Requests