#1057 raise error for non-existing task in list_task_output
Merged 5 years ago by mikem. Opened 5 years ago by tkopecek.
tkopecek/koji issue1048  into  master

@@ -6734,6 +6734,8 @@ 

      # get downloadable tasks

  

      base_task = session.getTaskInfo(base_task_id)

+     if not base_task:

+         parser.error(_("Task doesn't exist"))

  

      check_downloadable = lambda task: task["method"] == "buildArch"

      downloadable_tasks = []

file modified
+11 -1
@@ -4454,7 +4454,7 @@ 

      return None

  

  

- def list_task_output(taskID, stat=False, all_volumes=False):

+ def list_task_output(taskID, stat=False, all_volumes=False, strict=False):

      """List the files generated by the task with the given ID.  This

      will usually include one or more RPMs, and one or more log files.

      If the task did not generate any files, or the output directory
@@ -4482,7 +4482,17 @@ 

                  }

              }

          }

+ 

+     If strict is set, function will raise a GenericError if task doesn't

+     exist. Allows user to distinguish between empty output and non-existent task.

      """

+     if strict:

+         # raise error if task doesn't exist

+         try:

+             Task(taskID).getInfo(strict=True)

+         except:

+             raise koji.GenericError("Task doesn't exist")

+ 

      if stat or all_volumes:

          result = {}

      else:

Minor conflict with with PR #1098
I'll fix it in the rebase

Commit 12f9876 fixes this pull-request

Pull-Request has been merged by mikem

5 years ago