From 18e600d27f8d4222ca584353b006e1758a80618a Mon Sep 17 00:00:00 2001 From: Pragadeeswaran Sathyanarayanan Date: Thu, 18 Jul 2024 10:09:42 +0530 Subject: [PATCH] TFA: regression issue with long_running method Incorrect check was performed when evaluating maximum allocated run duration. This patch fixes the patch statement. Signed-off-by: Pragadeeswaran Sathyanarayanan --- ceph/ceph.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ceph/ceph.py b/ceph/ceph.py index f3fa6f1360f..3e22a32815e 100644 --- a/ceph/ceph.py +++ b/ceph/ceph.py @@ -1518,6 +1518,7 @@ def long_running(self, **kw): try: channel = ssh().get_transport().open_session() + channel.settimeout(timeout) # A mismatch between stdout and stderr streams have been observed hence # combining the streams and logging is set to debug level only. @@ -1542,7 +1543,7 @@ def long_running(self, **kw): data = channel.recv(1024) # time check - raise exception when exceeded. - if timeout is not None and _end_time > datetime.datetime.now(): + if timeout and datetime.datetime.now() > _end_time: channel.close() raise SocketTimeoutException( f"{cmd} failed to complete within {timeout}s"