[gnome-continuous-yocto/gnomeostree-3.28-rocko: 1157/8267] scripts/lib/bsp/engine.py: Add error message for wrong input file



commit 4252ec78a491f2828fb39d2087ace6e4c1339414
Author: Humberto Ibarra <humberto ibarra lopez intel com>
Date:   Mon Jul 4 14:54:53 2016 -0500

    scripts/lib/bsp/engine.py: Add error message for wrong input file
    
    Format of properties file is expected to be a simple json detailing properties, if this format fails an 
exception is thrown. This patch adds a graceful error message to the case when the properties file has a 
wrong format.
    
    [YOCTO #9750]
    
    (From meta-yocto rev: 7e543aa19d0d4b2112e6316783fb31b76df3493e)
    
    Signed-off-by: Ross Burton <ross burton intel com>
    Signed-off-by: Richard Purdie <richard purdie linuxfoundation org>

 scripts/lib/bsp/engine.py |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/scripts/lib/bsp/engine.py b/scripts/lib/bsp/engine.py
index 85f095e..760efc7 100644
--- a/scripts/lib/bsp/engine.py
+++ b/scripts/lib/bsp/engine.py
@@ -1547,11 +1547,13 @@ def yocto_common_create(machine, target, scripts_path, layer_output_dir, codedum
     if properties_file:
         try:
             infile = open(properties_file, "r")
+            properties = json.load(infile)
         except IOError:
             print("Couldn't open properties file %s for reading, exiting" % properties_file)
             sys.exit(1)
-
-        properties = json.load(infile)
+        except ValueError:
+            print("Wrong format on properties file %s, exiting" % properties_file)
+            sys.exit(1)
 
     if properties_str and not properties:
         properties = json.loads(properties_str)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]