diff options
author | Timothy Redaelli <tredaelli@redhat.com> | 2021-05-12 19:44:33 +0200 |
---|---|---|
committer | Ilya Maximets <i.maximets@ovn.org> | 2022-11-30 15:10:49 +0100 |
commit | cd475f976512bd1ce3abaf325c835780c37d6386 (patch) | |
tree | 8e46294dd704a5198a7adc5c003138e64b0bc466 /utilities | |
parent | 59e8cb8a053d50f49629be8b6fd614562d066404 (diff) | |
download | openvswitch-cd475f976512bd1ce3abaf325c835780c37d6386.tar.gz |
ovs-dpctl-top: Fix ovs-dpctl-top via pipe.
Currently it's not possible to use ovs-dpctl-top via pipe (eg:
ovs-dpctl dump-flows | ovs-dpctl-top --script --verbose) since Python3
doesn't allow to open a file (stdin in our case) in binary mode without
buffering enabled.
This commit changes the behaviour in order to directly pass stdin to
flows_read instead of re-opening it without buffering.
Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Diffstat (limited to 'utilities')
-rwxr-xr-x | utilities/ovs-dpctl-top.in | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/utilities/ovs-dpctl-top.in b/utilities/ovs-dpctl-top.in index fbe6e4f56..2c1766eff 100755 --- a/utilities/ovs-dpctl-top.in +++ b/utilities/ovs-dpctl-top.in @@ -1236,11 +1236,7 @@ def flows_script(args): if (args.flowFiles is None): logging.info("reading flows from stdin") - ihdl = os.fdopen(sys.stdin.fileno(), 'r', 0) - try: - flow_db = flows_read(ihdl, flow_db) - finally: - ihdl.close() + flow_db = flows_read(sys.stdin, flow_db) else: for flowFile in args.flowFiles: logging.info("reading flows from %s", flowFile) |