diff options
author | Aaron Conole <aconole@redhat.com> | 2020-03-02 11:05:06 -0500 |
---|---|---|
committer | Ben Pfaff <blp@ovn.org> | 2020-03-05 12:52:38 -0800 |
commit | 704ae35726cbc6e4bd1d3c68b0fe30aa5af45fb8 (patch) | |
tree | dcfe104e16f7133ee48b0443c84addb4e994b624 /utilities | |
parent | ffbe63cd4702ffa9fc7cd97f69ba6fbba308b0b3 (diff) | |
download | openvswitch-704ae35726cbc6e4bd1d3c68b0fe30aa5af45fb8.tar.gz |
ovs-dpctl-top: python3 compatibility
During the transition to python3 support, some syntax errors weren't
adequately cleaned. This addresses the various errors, plus one
minor issue with string type conversion.
Reported-at: https://bugzilla.redhat.com/show_bug.cgi?id=1809184
Tested-by: Flavio Leitner <fbl@sysclose.org>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'utilities')
-rwxr-xr-x | utilities/ovs-dpctl-top.in | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/utilities/ovs-dpctl-top.in b/utilities/ovs-dpctl-top.in index f2cc3f7f2..011cc64b7 100755 --- a/utilities/ovs-dpctl-top.in +++ b/utilities/ovs-dpctl-top.in @@ -592,7 +592,7 @@ def flows_read(ihdl, flow_db): try: flow_db.flow_line_add(line) - except ValueError, arg: + except ValueError as arg: logging.error(arg) return flow_db @@ -958,6 +958,9 @@ class FlowDB: change order of fields of the same flow. """ + if not isinstance(line, str): + line = str(line) + line = line.rstrip("\n") (fields, stats, _) = flow_line_split(line) @@ -988,7 +991,7 @@ class FlowDB: self.flow_event(fields_dict, stats_old_dict, stats_dict) - except ValueError, arg: + except ValueError as arg: logging.error(arg) self._error_count += 1 raise @@ -1192,7 +1195,7 @@ def flows_top(args): flows_read(ihdl, flow_db) finally: ihdl.close() - except OSError, arg: + except OSError as arg: logging.critical(arg) break @@ -1220,7 +1223,7 @@ def flows_top(args): # repeat output for (count, line) in lines: - print line + print(line) def flows_script(args): @@ -1249,7 +1252,7 @@ def flows_script(args): render = Render(console_width, Render.FIELD_SELECT_SCRIPT) for line in render.format(flow_db): - print line + print(line) def main(): |