#4322 Return BuildError when kickstart file is not exists
Opened 2 months ago by jcupova. Modified 24 days ago
jcupova/koji issue-4190  into  master

file modified
+7
@@ -3297,6 +3297,9 @@ 

          else:

              kspath = self.localPath("work/%s" % ksfile)

  

+         if not os.path.exists(kspath):

+             raise koji.BuildError('Kickstart %s does not exist.' % kspath)

+ 

          self.uploadFile(kspath)  # upload the original ks file

          return kspath  # full absolute path to the file in the chroot

  
@@ -4040,6 +4043,10 @@ 

                  kspath = os.path.join(self.workdir, os.path.basename(ksfile))

                  with open(kspath, 'wb') as ks_dest:

                      ks_dest.write(ks_src.read())

+ 

+         if not os.path.exists(kspath):

+             raise koji.BuildError('Kickstart %s does not exist.' % kspath)

+ 

          self.logger.debug('uploading kickstart from here: %s' % kspath)

          self.uploadFile(kspath)  # upload the original ks file

          return kspath  # absolute path to the ks file

grammar: should be 'Kickstart %s does not exist'

I'm not sure if this should be a PreBuildError. When git clones fail, we raise BuildError. There are only a few places where we currently use PreBuildError and they are all a but more removed from the actual task execution than this is.

I've asked for clarification in the issue. Note that there are two different fetchKickstart definitions in the code.

See comments in the issue. Before the upload code started to error on missing files, the case in the issue would have gone on to error when attempting to read the kickstart. This would have been a BuildError, so I think we should also make this a BuildError.

Also, we should fix this in both fetchKickstart methods as noted above.

rebased onto 77d56cc

2 months ago

@tkopecek , @mikem . Error renamed to BuildError and fixed for both fetchKickstart methods.

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

2 months ago

Can we fix the PR title and commit message to match the code change?

rebased onto 8e55098

2 months ago

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

24 days ago
Metadata