diff mbox series

[styhead] image.bbclass: Don't catch and ignore unexpected exceptions in image_qa

Message ID 20240926122559.1711799-1-pkj@axis.com
State Under Review
Headers show
Series [styhead] image.bbclass: Don't catch and ignore unexpected exceptions in image_qa | expand

Commit Message

Peter Kjellerstedt Sept. 26, 2024, 12:25 p.m. UTC
After commit 905e224849fbbed1719e0add231b00e2d570b3b4 (image_qa: fix
error handling), any unexpected exceptions in do_image_qa() would result
in a variable being set, but never used, effectively hiding the error.

Drop the catch for Exception and let any such exceptions pass through.

Also update the description of do_image_qa() to explain that the called
functions are expected to call oe.qa.handle_error() themselves, and that
the support for oe.utils.ImageQAFailed is deprecated and will be removed
in the next major release of OE-Core.

[ YOCTO #15601 ]

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
---
 meta/classes-recipe/image.bbclass | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/meta/classes-recipe/image.bbclass b/meta/classes-recipe/image.bbclass
index 834ae03f3c..793b550bfb 100644
--- a/meta/classes-recipe/image.bbclass
+++ b/meta/classes-recipe/image.bbclass
@@ -324,14 +324,19 @@  addtask do_image_complete_setscene
 # IMAGE_QA_COMMANDS += " \
 #     image_check_everything_ok \
 # "
+#
 # This task runs all functions in IMAGE_QA_COMMANDS after the rootfs
 # construction has completed in order to validate the resulting image.
 #
 # The functions should use ${IMAGE_ROOTFS} to find the unpacked rootfs
 # directory, which if QA passes will be the basis for the images.
 #
-# The functions should use oe.utils.ImageQAFailed(description, name) to raise
-# errors. The name must be listed in ERROR_QA or WARN_QA to prompt.
+# The functions are expected to call oe.qa.handle_error() to report any
+# problems. Alternatively, they can raise
+# oe.utils.ImageQAFailed(description, name), in which case the name
+# needs to be present in either ERROR_QA or WARN_QA for the message to
+# show. Raising ImageQAFailed is deprecated and will be removed in the
+# next major release of OE Core.
 fakeroot python do_image_qa () {
     from oe.utils import ImageQAFailed
 
@@ -343,8 +348,6 @@  fakeroot python do_image_qa () {
         except oe.utils.ImageQAFailed as e:
             qamsg = 'Image QA function %s failed: %s\n' % (e.name, e.description)
             oe.qa.handle_error(e.name, qamsg, d)
-        except Exception as e:
-            qamsg = qamsg + '\tImage QA function %s failed: %s\n' % (cmd, e)
 
     oe.qa.exit_if_errors(d)
 }