Fix: table_performance_improvements 75/9075/2
authorTibor Frank <tifrank@cisco.com>
Fri, 27 Oct 2017 08:56:01 +0000 (10:56 +0200)
committerTibor Frank <tifrank@cisco.com>
Fri, 27 Oct 2017 08:59:18 +0000 (10:59 +0200)
Change-Id: I5052d47988c1644768ed6c8cdefc76dc1defb898
Signed-off-by: Tibor Frank <tifrank@cisco.com>
resources/tools/presentation/generator_tables.py

index 0ff4de6..195380f 100644 (file)
@@ -189,12 +189,17 @@ def table_performance_improvements(table, input_data):
                     tbl_item.append({"data": eval(operation)(data_lst)})
             elif cmd == "operation":
                 operation = args[0]
                     tbl_item.append({"data": eval(operation)(data_lst)})
             elif cmd == "operation":
                 operation = args[0]
-                nr1 = tbl_item[int(args[1])]["data"]
-                nr2 = tbl_item[int(args[2])]["data"]
-                if nr1 and nr2:
-                    tbl_item.append({"data": eval(operation)(nr1, nr2)})
-                else:
+                try:
+                    nr1 = tbl_item[int(args[1])]["data"]
+                    nr2 = tbl_item[int(args[2])]["data"]
+                    if nr1 and nr2:
+                        tbl_item.append({"data": eval(operation)(nr1, nr2)})
+                    else:
+                        tbl_item.append({"data": None})
+                except IndexError:
+                    logging.error("No data for {0}".format(tbl_item[0]))
                     tbl_item.append({"data": None})
                     tbl_item.append({"data": None})
+                    continue
             else:
                 logging.error("Not supported command {0}. Skipping the table.".
                               format(cmd))
             else:
                 logging.error("Not supported command {0}. Skipping the table.".
                               format(cmd))

©2016 FD.io a Linux Foundation Collaborative Project. All Rights Reserved.
Linux Foundation is a registered trademark of The Linux Foundation. Linux is a registered trademark of Linus Torvalds.
Please see our privacy policy and terms of use.