[dunfell,1.46,2/2] bblayers/action: When adding layers, catch BBHandledException

Message ID b8c38db27d6b4f8716847badc771036c7e0133a6.1638555853.git.steve@sakoman.com
State Accepted, archived
Commit f18b65d0b9a6b983d53bde491e1bf2ca56949444
Headers show
Series [dunfell,1.46,1/2] cooker: Ensure reparsing is handled correctly | expand

Commit Message

Steve Sakoman Dec. 3, 2021, 6:27 p.m. UTC
From: Richard Purdie <richard.purdie@linuxfoundation.org>

When adding a layer, parse error can occur, raising BBHandledException.
Catch this and error, aborting the layer add to meet user expectations.

[YOCTO #14054]

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit ceddb5b3d229b83c172656053cd29aeb521fcce0)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
---
 lib/bblayers/action.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Patch

diff --git a/lib/bblayers/action.py b/lib/bblayers/action.py
index d6459d66..d2f9c1bb 100644
--- a/lib/bblayers/action.py
+++ b/lib/bblayers/action.py
@@ -50,10 +50,10 @@  class ActionPlugin(LayerPlugin):
             if not (args.force or notadded):
                 try:
                     self.tinfoil.run_command('parseConfiguration')
-                except bb.tinfoil.TinfoilUIException:
+                except (bb.tinfoil.TinfoilUIException, bb.BBHandledException):
                     # Restore the back up copy of bblayers.conf
                     shutil.copy2(backup, bblayers_conf)
-                    bb.fatal("Parse failure with the specified layer added")
+                    bb.fatal("Parse failure with the specified layer added, aborting.")
                 else:
                     for item in notadded:
                         sys.stderr.write("Specified layer %s is already in BBLAYERS\n" % item)