[yocto] [layerindex-web][PATCH 2/5] update_layer: improve exception handling
Paul Eggleton
paul.eggleton at linux.intel.com
Tue Aug 14 06:32:15 PDT 2018
When an exception occurs during the main part of update_layer, we were
catching and printing it but that's not enough - we need to do the
following as well:
* Use logger.error() to print the exception information, so that it gets
logged and highlighted as an error in the layer update
* Exit with a non-zero return code so that update.py knows it has failed
Signed-off-by: Paul Eggleton <paul.eggleton at linux.intel.com>
---
layerindex/update_layer.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/layerindex/update_layer.py b/layerindex/update_layer.py
index 2b39e8ef..d9c93360 100644
--- a/layerindex/update_layer.py
+++ b/layerindex/update_layer.py
@@ -808,7 +808,8 @@ def main():
pass
except:
import traceback
- traceback.print_exc()
+ logger.error(traceback.format_exc().rstrip())
+ sys.exit(1)
finally:
if tinfoil and (LooseVersion(bb.__version__) > LooseVersion("1.27")):
tinfoil.shutdown()
--
2.17.1
More information about the yocto
mailing list