Message ID | 20231030090259.15251-2-jmeng@redhat.com |
---|---|
State | Accepted |
Delegated to: | Simon Horman |
Headers | show |
Series | python: Remove duplicate UnixctlClient implementation. | expand |
Context | Check | Description |
---|---|---|
ovsrobot/apply-robot | success | apply and check: success |
ovsrobot/github-robot-_Build_and_Test | success | github build: passed |
On Mon, Oct 30, 2023 at 10:02:59AM +0100, jmeng@redhat.com wrote: > From: Jakob Meng <code@jakobmeng.de> > > The unixctl implementation in Python has been split into three parts in > the past. During this process the UnixctlClient was duplicated, in > python/ovs/unixctl/client.py and python/ovs/unixctl/server.py. This > patch removes the duplicate from the latter. > > Fixes: 53cf9963ccc6 ("python: Break unixctl implementation into registry, client, and server.") > Signed-off-by: Jakob Meng <code@jakobmeng.de> > Acked-by: Simon Horman <horms@ovn.org> > Acked-by: Eelco Chaudron <echaudro@redhat.com> Thanks Jakob, I have applied this patch. I have not backported as, although it has a fixes tag, I don't believe that it fixes a user-visible bug. Please let me know if you would like me to reconsider.
On 31.10.23 16:22, Simon Horman wrote: > On Mon, Oct 30, 2023 at 10:02:59AM +0100, jmeng@redhat.com wrote: >> From: Jakob Meng <code@jakobmeng.de> >> >> The unixctl implementation in Python has been split into three parts in >> the past. During this process the UnixctlClient was duplicated, in >> python/ovs/unixctl/client.py and python/ovs/unixctl/server.py. This >> patch removes the duplicate from the latter. >> >> Fixes: 53cf9963ccc6 ("python: Break unixctl implementation into registry, client, and server.") >> Signed-off-by: Jakob Meng <code@jakobmeng.de> >> Acked-by: Simon Horman <horms@ovn.org> >> Acked-by: Eelco Chaudron <echaudro@redhat.com> > Thanks Jakob, > > I have applied this patch. > > I have not backported as, although it has a fixes tag, I don't believe > that it fixes a user-visible bug. Please let me know if you would like > me to reconsider. > Thank you, Simon! Agreed, backporting it should not be necessary. The code itself is fine, just a perfect duplicate.
diff --git a/python/ovs/unixctl/server.py b/python/ovs/unixctl/server.py index 5f9b3e739..b9cb52fad 100644 --- a/python/ovs/unixctl/server.py +++ b/python/ovs/unixctl/server.py @@ -211,47 +211,3 @@ class UnixctlServer(object): version) return 0, UnixctlServer(listener) - - -class UnixctlClient(object): - def __init__(self, conn): - assert isinstance(conn, ovs.jsonrpc.Connection) - self._conn = conn - - def transact(self, command, argv): - assert isinstance(command, str) - assert isinstance(argv, list) - for arg in argv: - assert isinstance(arg, str) - - request = Message.create_request(command, argv) - error, reply = self._conn.transact_block(request) - - if error: - vlog.warn("error communicating with %s: %s" - % (self._conn.name, os.strerror(error))) - return error, None, None - - if reply.error is not None: - return 0, str(reply.error), None - else: - assert reply.result is not None - return 0, None, str(reply.result) - - def close(self): - self._conn.close() - self.conn = None - - @staticmethod - def create(path): - assert isinstance(path, str) - - unix = "unix:%s" % ovs.util.abs_file_name(ovs.dirs.RUNDIR, path) - error, stream = ovs.stream.Stream.open_block( - ovs.stream.Stream.open(unix)) - - if error: - vlog.warn("failed to connect to %s" % path) - return error, None - - return 0, UnixctlClient(ovs.jsonrpc.Connection(stream))