The script was never parsing the first cookie in the input. Also, add a
check to make sure that the cookie refers to a Logical_Flow before
trying to print the record.

Signed-off-by: Dumitru Ceara <dce...@redhat.com>
---
 utilities/ovn-detrace.in |   24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/utilities/ovn-detrace.in b/utilities/ovn-detrace.in
index 9471e37..34b6b0e 100755
--- a/utilities/ovn-detrace.in
+++ b/utilities/ovn-detrace.in
@@ -188,22 +188,26 @@ def main():
     cookie = None
     while True:
         line = sys.stdin.readline()
+
+        if line == '':
+            break
+
+        line = line.strip()
+
         if cookie:
             # print lflow info when the current flow block ends
-            if regex_table_id.match(line) or line.strip() == '':
+            if regex_table_id.match(line):
                 lflow = get_lflow_from_cookie(ovsdb_ovnsb, cookie)
-                print_lflow(lflow, "  * ")
-                print_lflow_nb_hint(lflow, "    * ", ovsdb_ovnnb)
-                cookie = None
+                if lflow:
+                    print_lflow(lflow, "  * ")
+                    print_lflow_nb_hint(lflow, "    * ", ovsdb_ovnnb)
+                    cookie = None
 
-        print line.strip()
-        if line == "":
-            break
+        print line
 
         m = regex_cookie.match(line)
-        if not m:
-            continue
-        cookie = m.group(1)
+        if m:
+            cookie = m.group(1)
 
 
 if __name__ == "__main__":

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to