#558 cli: Fix exit code for building images
Merged 2 years ago by mikem. Opened 2 years ago by lsedlar.
lsedlar/koji fix-return-value  into  master

file modified
+4 -4

@@ -5206,7 +5206,7 @@ 

                         " architecture, a build target, and a relative path to" +

                         " a kickstart file."))

          assert False  # pragma: no cover

-     _build_image(options, task_options, session, args, 'livecd')

+     return _build_image(options, task_options, session, args, 'livecd')

  

  

  # This handler is for spinning livemedia images

@@ -5266,7 +5266,7 @@ 

      if task_options.lorax_url is not None and task_options.lorax_dir is None:

          parser.error(_('The "--lorax_url" option requires that "--lorax_dir" '

                         'also be used.'))

-     _build_image(options, task_options, session, args, 'livemedia')

+     return _build_image(options, task_options, session, args, 'livemedia')

  

  

  # This handler is for spinning appliance images

@@ -5322,7 +5322,7 @@ 

                         "an architecture, a build target, and a relative path" +

                         " to a kickstart file."))

          assert False  # pragma: no cover

-     _build_image(options, task_options, session, args, 'appliance')

+     return _build_image(options, task_options, session, args, 'appliance')

  

  

  def handle_image_build_indirection(options, session, args):

@@ -5588,7 +5588,7 @@ 

          parser.error(

              _("You must specify --distro. Examples: Fedora-16, RHEL-6.4, " +

                "SL-6.4 or CentOS-6.4"))

-     _build_image_oz(options, task_options, session, args)

+     return _build_image_oz(options, task_options, session, args)

  

  

  def _build_image(options, task_opts, session, args, img_type):

When spin-livemedia, image-build etc. start a task and watch it, they never return a correct exit value. Pungi relies on the exit code to determine if the task failed or not.

Fixes: https://pagure.io/koji/issue/555

Commit 16be245 fixes this pull-request

Pull-Request has been merged by mikem@redhat.com

2 years ago