[ovs-dev] [PATCH ovn 2/3] ovn-detrace: Fix line parsing.
Dumitru Ceara
dceara at redhat.com
Fri Nov 8 11:15:28 UTC 2019
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 <dceara at 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__":
More information about the dev
mailing list